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.
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
Keywords
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.
Links
- Harvey P. Dale, Table of n, a(n) for n = 0..1000
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}
Comments