A379652 a(1) = 2. For n > 1, a(n) = smallest prime factor of c=2*a(n-1)+1 that is not in {a(1), ..., a(n-1)}; if all prime factors of c are in {a(1), ..., a(n-1)}, then we try the next value of c, which is 2*c+1; and so on.
2, 5, 11, 23, 47, 19, 3, 7, 31, 127, 17, 71, 13, 37, 151, 101, 29, 59, 239, 479, 137, 1103, 2207, 883, 2357, 41, 83, 167, 67, 271, 181, 727, 97, 1567, 6271, 113, 227, 911, 1823, 521, 149, 599, 109, 73, 197, 79, 53, 107, 43, 563, 347, 139, 373, 997, 307, 1231
Offset: 1
Keywords
Examples
a(6) is 19 because the prime factors of c=2*a(5)+1 (i.e., 95) are 5 and 19, and 5 already appears in the sequence as a(2). a(9) is 31 because the prime factors of c=2*a(8)+1 (i.e., 15) are 3 and 5 which already appear in the sequence as a(7) and a(2). The next value of c (i.e., 2*c+1) is 31, which is prime and does not already appear in the sequence.
Links
- Michael De Vlieger, Table of n, a(n) for n = 1..10000
Programs
-
Mathematica
c[_] := True; j = 2; c[2] = False; {j}~Join~Reap[Do[m = 2*j + 1; While[Set[k, SelectFirst[FactorInteger[m][[All, 1]], c] ]; !IntegerQ[k], m = 2*m + 1]; c[k] = False; j = Sow[k], {120}] ][[-1, 1]] (* Michael De Vlieger, Dec 29 2024 *)
-
Python
from sympy import primefactors seq = [2] seq_set = set(seq) max_seq_len=100 while len(seq) <= max_seq_len: c = seq[-1] done = False while not done: c = 2*c+1 factors = primefactors(c) for factor in factors: if factor not in seq_set: seq.append(factor) seq_set.add(factor) done = True break print(seq)
Comments