OFFSET
1,1
COMMENTS
For a guide to related sequences, see A377609.
EXAMPLE
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.
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 *)
CROSSREFS
KEYWORD
nonn,changed
AUTHOR
Clark Kimberling, Nov 05 2024
STATUS
approved