OFFSET
1,1
COMMENTS
For a guide to related sequences, see A377609.
EXAMPLE
Starting with prime(1) = 2, we have 2*2+1 = 5, then 2*5+1 = 11, etc., resulting in a chain 2, 5, 11, 23, 47, 95, 191, 383, 767, 1535, 3071, 6143, 12287, 24575, 49151, 983033 having 8 primes and 8 composites. Since every initial subchain has fewer composites than primes, a(1) = 16-1 = 15. (For more terms from the mapping x -> 2x+1, see A055010.)
MATHEMATICA
chain[{start_, u_, v_}] := NestWhile[Append[#, u*Last[#] + v] &, {start}, !
Count[#, _?PrimeQ] == Count[#, _?(! PrimeQ[#] &)] &];
chain[{Prime[1], 2, 1}]
Map[Length[chain[{Prime[#], 2, 1}]] &, Range[100]] - 1
(* Peter J. C. Moses, Oct 31 2024 *)
CROSSREFS
KEYWORD
nonn,new
AUTHOR
Clark Kimberling, Nov 05 2024
STATUS
approved