%I #19 Nov 09 2018 18:21:56
%S 3,2,2,4,5,3,6,6,3,6,7,6,3,7,8,5,4,6,9,9,6,5,6,5,7,10,4,10,8,3,7,7,5,
%T 9,6,8,4,4,7,4,7,7,8,6,8,8,8,6,9,8,8,6,8,8,7,5,8,11,8,7,4,4,6,4,3,9,
%U 16,10,6,8,9,7,6,7,10,7,9,7,6,12,8,7,6,5,9,5,5,7,7,7,5,10,10,9,8,10,4,7,10,10
%N a(n) is the number of distinct primes produced by starting with the n-th prime p and repeatedly looking at all the prime factors of 2p-1, and then performing the same process (double, subtract 1, find all prime factors) with those primes; a(n) = -1 if this produces infinitely many primes.
%C Inspired by and analogous to A305382.
%C Just as for A305382, it is conjectured that a(n) is finite for all n.
%C All primes less than prime(125000000) have been checked.
%C First occurrence of k=2,3,4,...: 2, 1, 4, 5, 7, 11, 15, 19, 26, 58, 80, 125, 169, 121, 67, 525, 808, 938, 1799, 1926, 2760, 10658, 4661, 14433, 47463, 22304, 11878, 32103, 101513, 146448, 249616, 266149, 2580007, 2060718, 2883547, 11483667, 8388622, 19786313, ..., .
%e a(5) = 5 because the 5th prime, 11 -> 21 -> 3 & 7 -> 5 & 13 -> 9 & 25 -> 3 & 5. Thus there are 5 primes in order of appearance {5, 11, 3, 7, 13}.
%t g[lst_List] := Union@ Join[lst, First@# & /@ Flatten[ FactorInteger[2lst -1], 1]]; f[n_] := Length@ NestWhile[g@# &, {Prime@n}, UnsameQ, All]; Table[ f[n], {n, 100}]
%o (PARI) a(n) = {va = [prime(n)]; done = 0; while (! done, done = 1; for (k=1, #va, f = factor(2*va[k]-1); for (j=1, #f~, if (! vecsearch(va, f[j,1]), va = Set(concat(va, f[j,1])); done = 0);););); #select(x->isprime(x), va);} \\ _Michel Marcus_, Jul 03 2018
%Y Cf. A305382.
%K nonn
%O 1,1
%A _Robert G. Wilson v_, Jun 18 2018