Prime patterns in a largest-prime-factor swap algorithm

21 views
Skip to first unread message

Ali Sada

unread,
Aug 16, 2026, 12:55:24 PM (11 days ago) Aug 16
to seq...@googlegroups.com

Hi everyone,

 

Hope all is well. Please see the algorithm below:


“Start with a list of positive integers > 1, L. At step n, swap L(n) with the least number that shares the same largest prime factor of L(n) that has not previously been used as a swap target.”


Examples:

L = (2,3,4,5,6,7,8,9,10,…)

n = 2: L(2) = 2, LPF = 2. Swap 2↔4.

n = 3: L(3) = 3, LPF = 3. Swap 3↔6.

n = 4: now L(4) = 2. Since 4 was already used, swap 2↔8.

n = 5: L(5) = 5, LPF = 5. Swap 5↔10.

n = 6: now L(6) = 3. Since 6 was used, swap 3↔9.

And so on.

 

In this algorithm, primes always initiate the swap, and that produces two sequences:


Sequence A gives us all composite numbers larger than 1.

4,6,8,10,9,14,16,12,15,22,18,26,21,20,32,34,24,38,25,28,33,46,27,30,39,36,35,58,40,62,64,44,51,42,48,74,57,52,45,82,49,86,55,50,69,94,54,56,60,68,65,106,72,66,63,76,87,118,75,122,93,70,128,78,77,134,85,92,84,142,81,146,111,80,95,88,91,158,90,96,123,166,98,102,129,116,99,178,100,104,115,124,141,114,108,194,105,110,120,202.

 

And sequence B gives the associated primes, with each prime p appearing infinitely often, but with decreasing density as p increases and as n grows.

2,3,2,5,3,7,2,3,5,11,3,13,7,5,2,17,3,19,5,7,11,23,3,5,13,3,7,29,5,31,2,11,17,7,3,37,19,13,5,41,7,43,11,5,23,47,3,7,5,17,13,53,3,11,7,19,29,59,5,61,31,7,2,13,11,67,17,23,7,71,3,73,37,5,19,11,7,79,5,3,41,83,7,17,43,29,11,89,5,13,23,31,47,19,3,97,7,11,5,101

 

For the first 10,000 terms I found:

 

1)      B(p^k−1) = p for every prime p and k ≥ 1.

2)      A(m−1) = 2m m is prime or m {4,10}.

3)      For Sequence B, between any two consecutive occurrences of a prime p > 2, every prime less than p appears at least once.

4)      B(n) is the largest prime factor of A(n) most of the time (almost 90% in the first 10,000 terms). Can we prove that this percentage goes down to zero when n approaches infinity?

 

I would really appreciate it if you could tell me if these two sequences are suitable for the OEIS.

 

Best,

 

Ali

 

         

 

 

 

 


Ali Sada

unread,
Aug 16, 2026, 2:28:06 PM (10 days ago) Aug 16
to seq...@googlegroups.com
Hi everyone,

A friend of mine just told me both sequences already exist in the OEIS. I thought I had searched for the terms but apparently I didn't. I just wanted to expand on the idea of  A398799.I sincerely apologize for waisting your time.

Best,

Ali 
Reply all
Reply to author
Forward
0 new messages