A293980 Number of iterations of A174221 (the PrimeLatz map) required to enter a loop, for initial value n, or -1 if this never happens.
0, 1, 2, 1, 3, 1, 2, 6, 4, 0, 2, 0, 3, 0, 7, 0, 5, 0, 0, 14, 3, 0, 0, 2, 4, 0, 0, 21, 8, 29, 0, 18, 6, 12, 0, 69, 0, 0, 15, 66, 4, 6, 0, 21, 0, 15, 3, 31, 5, 39, 0, 12, 0, 3, 22, 28, 9, 2, 30, 25, 0, 0, 19, 6, 7, 30, 13, 19, 0, 27, 70, 11, 0, 24, 0, 30, 16, 10, 67, 15, 5, 21, 7, 16180, 0
Offset: 0
Keywords
Examples
Starting with 1 (cf. A193230), one gets 1 -> A174221(1) = (1 + 2 + 3 + 5) = 11 which is part of the loop, therefore a(1) = 1. Without having precomputed the loop, one can also iterate until a value occurs for the second time. This would give 1 -> 11 -> 60 -> 30 -> 15 -> 74 -> 37 -> 168 -> 84 -> 42 -> 21 -> 104 -> 52 -> 26 -> 13 -> 72 -> 36 -> 18 -> 9 -> 50 -> 25 -> 122 -> 61 -> 272 -> 136 -> 68 -> 34 -> 17 -> 88 -> 44 -> 22 -> 11: After 31 iterations one gets again 11 which was already there after the first iteration. Since the loop is of length 30, it was entered after 31 - 30 = 1 iteration(s). Starting with 83, it takes 16179 iterations to reach 3 (not yet in the loop) and one more to reach 26, an element of the loop. In this orbit, the largest value is 10780054699424618132644155893087038044817868609971935265882538442720, reached after 8337 iterations. See A293979 for the trajectory of 83. The few other n (141, 147, 151, 161, 166, 185, ...) which have an orbit larger than 100 elements mostly have trajectories that merge quite soon into that of 83 (-> 370 -> 185, and 161 -> 664 -> 332 -> 166 -> 83, and 147 -> 604 -> 302 -> 151 -> (6 more steps) -> 675 -> 2726 -> (23 more steps) -> 370, and 141 -> (36 more steps) -> 5452 -> 2726. Therefore these have an orbit of roughly the same size, a(n) ~ 16200. See the comments for the exceptions.
Links
- M. F. Hasler, Table of n, a(n) for n = 0..199
- Eric Angelini, The PrimeLatz conjecture
Crossrefs
Programs
-
Mathematica
Array[LengthWhile[#, Function[k, k != Last@ #]] &@ NestWhileList[If[EvenQ@ #, #/2, Total@ Prepend[NextPrime[#, {1, 2, 3}], #]] &, #, UnsameQ, All] &, 82] (* Michael De Vlieger, Oct 25 2017 *)
-
PARI
S=Set(vector(t=30,i,t=A174221(t))); A293980(n)={n&&for(k=0,oo,setsearch(S,n)&&return(k);n=A174221(n))} \\ Uses the hypothesis that Orbit(30) = Orbit(9) is the only "loop". (Precomputed and stored in global variable S.) A293980(n,A=vector(30))={n&&for(k=0,oo,A[k%30+1]==n&&return(k-30);n=A174221(A[k%30+1]=n))} \\ Alternative code: store the 30 most recently computed values and stop when a(k) = a(k-30). Roughly the same speed; does not require the precomputed loop & global variable S. Would also work for another hypothetical loop of length 30. Could easily be modified to detect loops of other length, not without performance hit: most efficient would probably be to keep both, a sorted (Set) and unsorted (i.e., "chronological") record of the last N values.)
Comments