This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A377609 #10 Nov 14 2024 12:11:10 %S A377609 7,5,1,3,1,1,1,9,1,1,5,3,1,1,1,1,1,1,1,1,1,19,1,1,5,1,1,1,1,1,1,1,1,3, %T A377609 1,1,7,1,1,1,1,1,1,1,1,3,3,1,1,3,1,1,1,1,1,1,1,7,1,1,1,1,3,1,1,1,13,7, %U A377609 1,1,1,1,3,1,3,1,1,1,1,1,1,1,1,1,5,1 %N A377609 a(n) is the number of iterations of x -> 2*x - 1 until (# composites reached) = (# primes reached), starting with prime(n). %C A377609 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). %C A377609 In the following guide to related sequences LIC abbreviates "length of initial chain": %C A377609 sequence 1st term generator LIC %C A377609 A377609 2 x -> 2x-1 8 %C A377609 A377610 5 x -> 2x-3 14 %C A377609 A377611 11 x -> 2x-5 26 %C A377609 A377612 2 x -> 2x+1 16 %C A377609 A377613 2 x -> 2x+3 20 %C A377609 A377614 2 x -> 2x+5 2 %C A377609 A377615 2 x -> 2x+7 24 %C A377609 A377616 2 x -> 3x+2 2 %C A377609 A377617 2 x -> 3x+4 2 %C A377609 A377618 2 x -> 4x-1 6 %C A377609 A377619 2 x -> 5x+2 2 %C A377609 A377620 2 x -> 5x+4 2 %C A377609 A377621 2 x -> 6x-1 2 %C A377609 A377622 2 x -> 6x-5 12 %C A377609 A377623 2 x -> 6x+1 16 %C A377609 A377624 2 x -> 6x+5 18 %e A377609 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.) %t A377609 chain[{start_, u_, v_}] := NestWhile[Append[#, u*Last[#] + v] &, {start}, ! %t A377609 Count[#, _?PrimeQ] == Count[#, _?(! PrimeQ[#] &)] &]; %t A377609 chain[{Prime[1], 2, -1}] %t A377609 Map[Length[chain[{Prime[#], 2, -1}]] &, Range[100]] - 1 %t A377609 (* _Peter J. C. Moses_, Oct 31 2024 *) %Y A377609 Cf. A000040, A000051, A377610-A377624. %K A377609 nonn %O A377609 1,1 %A A377609 _Clark Kimberling_, Nov 05 2024