A377613 a(n) is the number of iterations of x -> 2*x + 3 until (# composites reached) = (# primes reached), starting with prime(n).
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, 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, 19, 1, 1, 1, 1, 3, 1, 3, 3, 1, 1, 1, 3, 3, 1, 17, 1, 3, 1
Offset: 1
Keywords
Examples
Starting with prime(1) = 2, we have 2*2+3 = 7, then 2*7+3 = 17, etc., 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 -> 2*x+3, see A154117.)
Programs
-
Mathematica
chain[{start_, u_, v_}] := NestWhile[Append[#, u*Last[#] + v] &, {start}, ! Count[#, ?PrimeQ] == Count[#, ?(! PrimeQ[#] &)] &]; chain[{Prime[1], 2, 3}] Map[Length[chain[{Prime[#], 2, 3}]] &, Range[100]] - 1 (* Peter J. C. Moses Oct 31 2024 *)
Comments