OFFSET
1,1
COMMENTS
This sequence represents a family of sequences (s(n)) defined as follows: suppose that u and v are fixed coprime integers, with u >= 2. Let s(n) be the number of iterations of x -> u*x + v until (# composites reached) = (# primes reached), starting with prime(n).
In the following guide to related sequences LIC abbreviates "length of initial chain":
sequence 1st term generator LIC
A377609 2 x -> 2x-1 8
A377610 5 x -> 2x-3 14
A377611 11 x -> 2x-5 26
A377612 2 x -> 2x+1 16
A377613 2 x -> 2x+3 20
A377614 2 x -> 2x+5 2
A377615 2 x -> 2x+7 24
A377616 2 x -> 3x+2 2
A377617 2 x -> 3x+4 2
A377618 2 x -> 4x-1 6
A377619 2 x -> 5x+2 2
A377620 2 x -> 5x+4 2
A377621 2 x -> 6x-1 2
A377622 2 x -> 6x-5 12
A377623 2 x -> 6x+1 16
A377624 2 x -> 6x+5 18
EXAMPLE
Starting with prime(1) = 2, we have 2*2-1 = 3, then 2*3-1 = 5, etc., resulting in a chain 2 -> 3 -> 5 -> 9 -> 17 -> 33 -> 65 -> 129. Writing p for primes and c for nonprimes, the chain gives p, p, p, c, p, c, c, c, so that a(1) = 7, since it takes 7 arrows for the number of c's to catch up to the number of p's. (For more terms from the mapping x -> 2x-1, see A000051.)
MATHEMATICA
chain[{start_, u_, v_}] := NestWhile[Append[#, u*Last[#] + v] &, {start}, !
Count[#, _?PrimeQ] == Count[#, _?(! PrimeQ[#] &)] &];
chain[{Prime[1], 2, -1}]
Map[Length[chain[{Prime[#], 2, -1}]] &, Range[100]] - 1
(* Peter J. C. Moses, Oct 31 2024 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Clark Kimberling, Nov 05 2024
STATUS
approved