cp's OEIS Frontend

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.

A377609 a(n) is the number of iterations of x -> 2*x - 1 until (# composites reached) = (# primes reached), starting with prime(n).

Original entry on oeis.org

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, 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, 1, 1, 1, 1, 3, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1
Offset: 1

Views

Author

Clark Kimberling, Nov 05 2024

Keywords

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

Examples

			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.)
		

Crossrefs

Programs

  • 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 *)