A377611 a(n) is the number of iterations of x -> 2*x - 5 until (# composites reached) = (# primes reached), starting with prime(n+4).
25, 1, 19, 1, 11, 15, 1, 1, 1, 1, 13, 9, 3, 1, 1, 21, 1, 1, 1, 11, 1, 7, 1, 1, 1, 1, 1, 11, 17, 1, 3, 1, 1, 1, 1, 1, 13, 1, 1, 1, 5, 1, 1, 1, 3, 1, 3, 1, 1, 1, 9, 9, 1, 1, 1, 15, 1, 1, 1, 5, 1, 1, 1, 1, 1, 1, 11, 1, 1, 1, 1, 3, 3, 1, 3, 1, 1, 1, 7, 1, 1, 3
Offset: 1
Keywords
Examples
Starting with prime(5) = 11, we have 2*11-5 = 17, then 2*17-5 = 31, etc., resulting in a chain 11, 17, 29, 53, 101, 197, 389, 773, 1541, 3077, 6149, 12293, 24581, 49157, 98309, 196613, 393221, 786437, 1572869, 3145733, 6291461, 12582917, 25165829, 50331653, 100663301, 201326597 having 13 primes and 13 composites. Since every initial subchain has fewer composites than primes, a(1) = 26-1 = 25.
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[5], 2, -5}] Map[Length[chain[{Prime[#], 2, -5}]] &, Range[5, 100]] - 1 (* Peter J. C. Moses, Oct 31 2024 *)
Comments