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.

A293982 Length (= size) of the orbit of n under iterations of A293975: x -> x/2 if even, x + nextprime(x) if odd; or -1 if the orbit is infinite.

Original entry on oeis.org

1, 5, 5, 5, 5, 8, 6, 13, 5, 11, 9, 9, 7, 10, 14, 8, 6, 14, 12, 14, 10, 12, 10, 13, 8, 19, 11, 17, 15, 11, 9, 17, 7, 17, 15, 15, 13, 15, 15, 13, 11, 15, 13, 18, 11, 16, 14, 22, 9, 16, 20, 14, 12, 18, 18, 16, 16, 14, 12, 12, 10, 10, 18, 22, 8, 20, 18, 20, 16, 18, 16, 16, 14
Offset: 0

Views

Author

M. F. Hasler, Nov 05 2017

Keywords

Comments

The orbit of x under f is O(x; f) = { f^k(x); k = 0, 1, 2,... }.
It is conjectured that for f = A293975, the trajectory (f^k(x); k >= 0) ends in the cycle 1 -> 3 -> 8 -> 4 -> 2 -> 1 for any starting value x.

Examples

			a(0) = 1 = # { 0 }, since 0 -> 0 -> 0 ... under A293975.
a(1) = 5 = # { 1, 3, 8, 4, 2 }, since 1 -> (1 + 2 =) 3 -> (3 + 5 =) 8 -> 4 -> 2 -> 1 -> 3 etc... under A293975.
a(2) = 5 = # { 2, 1, 3, 8, 4 }, since 2 -> 1 -> 3 -> 8 -> 4 -> 2 -> 1 etc... under A293975.
a(5) = 8 = # { 5, 12, 6, 3, 8, 4, 2, 1 }, since 5 -> (5 + 7 =) 12 -> 6 -> 3 -> (3 + 5 =) 8 -> 4 -> 2 -> 1 -> 3 etc... under A293975.
		

Crossrefs

Cf. A293975, A174221 (the "PrimeLatz" map), A006370 (the "3x+1" map).

Programs

  • Mathematica
    Table[Flatten[FindTransientRepeat[NestList[If[EvenQ[#],#/2,#+ NextPrime[ #]]&,n,100],3]]//Length,{n,0,80}] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Jun 13 2018 *)
  • PARI
    A293982(n,S=[n])={while(#S<#S=setunion(S,[n=A293975(n)]),);#S}