OFFSET
1,1
COMMENTS
For a guide to related sequences, see A377609.
EXAMPLE
Starting with prime(3) = 5, we have 2*5-3 = 7, then 2*7-3 = 11, etc., resulting in a chain 5, 7, 11, 19, 35, 67, 131, 259, 515, 1027, 2051, 4099, 8195, 16387 having 7 primes and 7 composites. Since every initial subchain has fewer composites than primes, a(1) = 14-1 = 13. (For more terms from the mapping x -> 2x-3, see A062709.)
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[3], 2, -3}]
Map[Length[chain[{Prime[#], 2, -3}]] &, Range[3, 100]] - 1
(* Peter J. C. Moses, Oct 31 2024 *)
CROSSREFS
KEYWORD
nonn,new
AUTHOR
Clark Kimberling, Nov 05 2024
STATUS
approved