A377615 a(n) is the number of iterations of x -> 2*x + 7 until (# composites reached) = (# primes reached), starting with prime(n).
23, 7, 9, 1, 21, 1, 7, 1, 21, 1, 1, 1, 3, 1, 3, 19, 1, 1, 1, 5, 1, 1, 7, 1, 1, 1, 1, 1, 1, 17, 1, 9, 17, 1, 1, 1, 1, 1, 1, 5, 1, 1, 3, 1, 15, 1, 1, 1, 9, 1, 1, 1, 1, 3, 17, 1, 1, 1, 1, 15, 1, 11, 1, 1, 1, 5, 1, 1, 11, 1, 1, 1, 1, 1, 1, 23, 1, 1, 11, 1, 1, 1
Offset: 1
Keywords
Examples
Starting with prime(1) = 2, we have 2*2+7 = 11, then 2*11+7 = 29, etc., resulting in a chain 2, 11, 29, 65, 137, 281, 569, 1145, 2297, 4601, 9209, 18425, 36857, 73721, 147449, 294905, 589817, 1179641, 2359289, 4718585, 9437177, 18874361, 37748729, 75497465 having 24 primes and 24 composites. Since every initial subchain has fewer composites than primes, a(1) = 24-1 = 23. (For more terms from the mapping x -> 2x+7, see A154251.)
Programs
-
Mathematica
chain[{start_, u_, v_}] := NestWhile[Append[#, u*Last[#] + v] &, {start}, ! Count[#, ?PrimeQ] == Count[#, ?(! PrimeQ[#] &)] &]; chain[{Prime[1], 2, 7}] Map[Length[chain[{Prime[#], 2, 7}]] &, Range[100]] - 1 (* Peter J. C. Moses Oct 31 2024 *)
Comments