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.

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

Original entry on oeis.org

1, 9, 5, 7, 1, 3, 3, 7, 5, 11, 1, 3, 1, 7, 1, 1, 5, 1, 1, 1, 1, 5, 13, 5, 11, 1, 3, 1, 1, 1, 5, 1, 1, 31, 7, 1, 1, 3, 9, 3, 1, 1, 1, 1, 3, 5, 1, 1, 3, 1, 5, 3, 1, 1, 3, 1, 3, 1, 1, 1, 1, 9, 1, 1, 3, 5, 1, 5, 1, 3, 3, 1, 3, 1, 1, 3, 1, 11, 1, 5, 29, 1, 1, 7
Offset: 1

Views

Author

Clark Kimberling, Nov 17 2024

Keywords

Comments

For a guide to related sequences, see A377609.

Examples

			Starting with prime(1) = 2, we have 2*2+2 = 6; the chain (2,6) has 1 prime and 1 composite. So a(1) = 2-1 = 1.
		

Crossrefs

Cf. A377609.

Programs

  • Mathematica
    chain[{start_, u_, v_}] := NestWhile[Append[#, u*Last[#] + v] &, {start}, !
         Count[#, ?PrimeQ] == Count[#, ?(! PrimeQ[#] &)] &];
    chain[{Prime[1], 3, 2}]
    Map[Length[chain[{Prime[#], 3, 2}]] &, Range[100]] - 1
    (* Peter J. C. Moses, Oct 31 2024 *)