login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A377611
a(n) is the number of iterations of x -> 2*x - 5 until (# composites reached) = (# primes reached), starting with prime(n+4).
1
25, 1, 19, 1, 11, 15, 1, 1, 1, 1, 13, 9, 3, 1, 1, 21, 1, 1, 1, 11, 1, 7, 1, 1, 1, 1, 1, 11, 17, 1, 3, 1, 1, 1, 1, 1, 13, 1, 1, 1, 5, 1, 1, 1, 3, 1, 3, 1, 1, 1, 9, 9, 1, 1, 1, 15, 1, 1, 1, 5, 1, 1, 1, 1, 1, 1, 11, 1, 1, 1, 1, 3, 3, 1, 3, 1, 1, 1, 7, 1, 1, 3
OFFSET
1,1
COMMENTS
For a guide to related sequences, see A377609.
EXAMPLE
Starting with prime(5) = 11, we have 2*11-5 = 17, then 2*17-5 = 31, etc., resulting in a chain 11, 17, 29, 53, 101, 197, 389, 773, 1541, 3077, 6149, 12293, 24581, 49157, 98309, 196613, 393221, 786437, 1572869, 3145733, 6291461, 12582917, 25165829, 50331653, 100663301, 201326597 having 13 primes and 13 composites. Since every initial subchain has fewer composites than primes, a(1) = 26-1 = 25.
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[5], 2, -5}]
Map[Length[chain[{Prime[#], 2, -5}]] &, Range[5, 100]] - 1
(* Peter J. C. Moses, Oct 31 2024 *)
CROSSREFS
Cf. A377609.
Sequence in context: A040645 A040646 A040647 * A126647 A040648 A272129
KEYWORD
nonn
AUTHOR
Clark Kimberling, Nov 05 2024
STATUS
approved