A377612 a(n) is the number of iterations of x -> 2*x + 1 until (# composites reached) = (# primes reached), starting with prime(n).
15, 7, 13, 1, 11, 1, 1, 1, 7, 7, 1, 1, 5, 1, 1, 11, 1, 1, 1, 1, 1, 1, 3, 23, 1, 1, 1, 1, 1, 11, 1, 3, 1, 1, 1, 1, 1, 1, 1, 3, 19, 1, 3, 1, 1, 1, 1, 1, 1, 1, 7, 3, 1, 3, 1, 1, 1, 1, 1, 3, 1, 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 17, 1, 1, 1, 1, 1, 1, 1, 1, 11, 1, 3
Offset: 1
Keywords
Examples
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.)
Crossrefs
Cf. A377609.
Programs
-
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 *)
Comments