%I #4 Nov 17 2024 07:32:19
%S 19,1,15,15,1,13,13,15,1,3,1,1,1,7,27,3,1,1,25,1,3,1,1,5,23,1,1,1,1,7,
%T 3,1,23,3,1,1,9,1,17,5,1,1,1,3,19,7,1,3,3,3,1,1,1,1,1,1,3,1,21,1,3,1,
%U 19,1,1,1,1,3,1,3,3,1,1,1,3,3,1,17,1,3,1
%N a(n) is the number of iterations of x -> 2*x + 3 until (# composites reached) = (# primes reached), starting with prime(n).
%C For a guide to related sequences, see A377609.
%e Starting with prime(1) = 2, we have 2*2+3 = 7, then 2*7+3 = 17, etc.,
%e resulting in a chain 2, 7, 17, 37, 77, 157, 317, 637, 1277, 2557, 5117, 10237, 20477, 40957, 81917, 163837, 327677, 655357, 1310717, 2621437 having 10 primes and 10 composites. Since every initial subchain has fewer composites than primes, a(1) = 20-1 = 19. (For more terms from the mapping x -> 2x+3, see A154117.)
%t chain[{start_, u_, v_}] := NestWhile[Append[#, u*Last[#] + v] &, {start}, !
%t Count[#, _?PrimeQ] == Count[#, _?(! PrimeQ[#] &)] &];
%t chain[{Prime[1], 2, 3}]
%t Map[Length[chain[{Prime[#], 2, 3}]] &, Range[100]] - 1
%t (* _Peter J. C. Moses_ Oct 31 2024 *
%Y Cf. A377609, A154117.
%K nonn,new
%O 1,1
%A _Clark Kimberling_, Nov 13 2024