A377609 a(n) is the number of iterations of x -> 2*x - 1 until (# composites reached) = (# primes reached), starting with prime(n).
7, 5, 1, 3, 1, 1, 1, 9, 1, 1, 5, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 19, 1, 1, 5, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 7, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 7, 1, 1, 1, 1, 3, 1, 1, 1, 13, 7, 1, 1, 1, 1, 3, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1
Offset: 1
Keywords
Examples
Starting with prime(1) = 2, we have 2*2-1 = 3, then 2*3-1 = 5, etc., resulting in a chain 2 -> 3 -> 5 -> 9 -> 17 -> 33 -> 65 -> 129. Writing p for primes and c for nonprimes, the chain gives p, p, p, c, p, c, c, c, so that a(1) = 7, since it takes 7 arrows for the number of c's to catch up to the number of p's. (For more terms from the mapping x -> 2x-1, see A000051.)
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