login
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.
8

%I #35 Jan 02 2025 14:23:28

%S 2,5,11,23,47,19,3,7,31,127,17,71,13,37,151,101,29,59,239,479,137,

%T 1103,2207,883,2357,41,83,167,67,271,181,727,97,1567,6271,113,227,911,

%U 1823,521,149,599,109,73,197,79,53,107,43,563,347,139,373,997,307,1231

%N 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.

%C The following are some statistics about how many terms of the sequence are required, so that the first k primes are included:

%C - The first 10^2 terms include the first 17 primes.

%C - The first 10^3 terms include the first 131 primes.

%C - The first 10^4 terms include the first 808 primes.

%C - The first 10^5 terms include the first 4397 primes.

%C - The first 10^6 terms include the first 35801 primes.

%C - The first 10^7 terms include the first 253682 primes.

%C Conjecture: this sequence is a permutation of the primes.

%C If we start with 1 instead of 2 we get A379727. - _N. J. A. Sloane_, Dec 31 2024

%H Michael De Vlieger, <a href="/A379652/b379652.txt">Table of n, a(n) for n = 1..10000</a>

%e 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).

%e 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.

%t c[_] := True; j = 2; c[2] = False;

%t {j}~Join~Reap[Do[m = 2*j + 1;

%t While[Set[k, SelectFirst[FactorInteger[m][[All, 1]], c] ];

%t !IntegerQ[k],

%t m = 2*m + 1];

%t c[k] = False; j = Sow[k], {120}] ][[-1, 1]] (* _Michael De Vlieger_, Dec 29 2024 *)

%o (Python)

%o from sympy import primefactors

%o seq = [2]

%o seq_set = set(seq)

%o max_seq_len=100

%o while len(seq) <= max_seq_len:

%o c = seq[-1]

%o done = False

%o while not done:

%o c = 2*c+1

%o factors = primefactors(c)

%o for factor in factors:

%o if factor not in seq_set:

%o seq.append(factor)

%o seq_set.add(factor)

%o done = True

%o break

%o print(seq)

%Y Cf. A031439, A072268, A131200, A174162, A379648.

%K nonn

%O 1,1

%A _Robert C. Lyons_, Dec 28 2024