OFFSET
1,2
COMMENTS
For a guide to related sequences, see A377609.
EXAMPLE
Starting with prime(1) = 2, we have 2*2+2 = 6; the chain (2,6) has 1 prime and 1 composite. So a(1) = 2-1 = 1.
MATHEMATICA
chain[{start_, u_, v_}] := NestWhile[Append[#, u*Last[#] + v] &, {start}, !
Count[#, _?PrimeQ] == Count[#, _?(! PrimeQ[#] &)] &];
chain[{Prime[1], 3, 2}]
Map[Length[chain[{Prime[#], 3, 2}]] &, Range[100]] - 1
(* Peter J. C. Moses, Oct 31 2024 *)
CROSSREFS
KEYWORD
nonn,new
AUTHOR
Clark Kimberling, Nov 17 2024
STATUS
approved