A377619 a(n) is the number of iterations of x -> 5*x + 2 until (# composites reached) = (# primes reached), starting with prime(n).
1, 3, 1, 5, 1, 7, 1, 11, 1, 1, 7, 1, 1, 1, 1, 1, 1, 9, 3, 1, 5, 5, 1, 1, 9, 1, 1, 1, 17, 1, 1, 1, 1, 1, 1, 3, 5, 1, 1, 1, 1, 3, 1, 3, 1, 9, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 7, 1, 1, 9, 1, 1, 1, 9, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1
Offset: 1
Keywords
Examples
Starting with prime(1) = 2, we have 5*2+2 = 12; the chain (2,12) has 1 prime and 1 composite. So a(1) = 2-1 = 1.
Crossrefs
Cf. A377609.
Programs
-
Mathematica
chain[{start_, u_, v_}] := If[CoprimeQ[u, v] && start*u + v != start, NestWhile[Append[#, u*Last[#] + v] &, {start}, ! Count[#, ?PrimeQ] == Count[#, ?(! PrimeQ[#] &)] &], {}]; chain[{Prime[1], 5, 2}] Map[Length[chain[{Prime[#], 5, 2}]] &, Range[1, 100]] - 1 (* Peter J. C. Moses, Oct 31 2024 *)
Comments