OFFSET
1,1
COMMENTS
For a guide to related sequences, see A377609.
EXAMPLE
Starting with prime(1) = 2, we have 6*2+5 = 17, then 6*17+5 = 107, etc., resulting in a chain 2, 17, 107, 647, 3887, 23327, 139967, 839807, 5038847, 30233087, 181398527, 1088391167, 6530347007, 39182082047, 235092492287, 1410554953727, 8463329722367, 50779978334207 having 9 primes and 9 composites. Since every initial subchain has fewer composites than primes, a(1) = 18-1 = 17. (For more terms from the mapping x -> 6x-5, see A198796.)
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], 6, -5}]
Map[Length[chain[{Prime[#], 6, -5}]] &, Range[1, 100]] - 1
(* Peter J. C. Moses, Oct 31 2024 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Clark Kimberling, Nov 20 2024
STATUS
approved