OFFSET
1,1
COMMENTS
For a guide to related sequences, see A377609.
EXAMPLE
Starting with prime(1) = 2, we have 4*2-1 = 7, then 4*7-1 = 27, etc.,
resulting in a chain 2, 7, 27, 107, 427, 1707 having 3 primes and 3 composites. Since every initial subchain has fewer composites than primes, a(1) = 6-1 = 5. (For more terms from the mapping x -> 4x-1, see A136412.)
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], 4, -1}]
Map[Length[chain[{Prime[#], 4, -1}]] &, Range[1, 100]] - 1
(* Peter J. C. Moses, Oct 31 2024 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Clark Kimberling, Nov 17 2024
STATUS
approved