OFFSET
1,1
COMMENTS
For a guide to related sequences, see A377609.
EXAMPLE
Starting with prime(1) = 2, we have 6*2-1 = 11, then 6*11-1 = 65, etc., resulting in a chain 2, 11, 65, 389, 2333, 13997, 83981, 503885, 3023309, 18139853, 108839117, 653034701 having 6 primes and 6 composites. Since every initial subchain has fewer composites than primes, a(1) = 12-1 = 11. (For more terms from the mapping x -> 6x-1, see A199412.)
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, -1}]
Map[Length[chain[{Prime[#], 6, -1}]] &, Range[1, 100]] - 1
(* Peter J. C. Moses, Oct 31 2024 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Clark Kimberling, Nov 20 2024
STATUS
approved