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.
%I A293980 #18 Oct 31 2017 19:33:00 %S A293980 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, %T A293980 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, %U A293980 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 %N A293980 Number of iterations of A174221 (the PrimeLatz map) required to enter a loop, for initial value n, or -1 if this never happens. %C A293980 Apart from the fixed point 0, the only known loop of A174221 appears to be (9, 50, 25, 122, 61, 272, 136, 68, 34, 17, 88, 44, 22, 11, 60, 30, 15, 74, 37, 168, 84, 42, 21, 104, 52, 26, 13, 72, 36, 18), of length 30. This has been verified up to 10^8. %C A293980 The trajectory of all positive numbers considered so far enters this loop. %C A293980 If n is a term of that loop (or n = 0), then a(n) = 0. For any positive integer not part of this loop, a(n) is the number of iterations of A174221 until an element of this loop is reached. It can also be defined as the number of iterations until reaching a number which already occurred earlier in the orbit, minus the number of iterations needed to see that number again (which appears to be 30 for all positive integers). %C A293980 The trajectory of most positive integers merges very soon (say, in a(n) < 100 steps for most n < 1000) into the above loop. For example, starting with 1, one enters this loop right after the first iteration, cf. A193230. %C A293980 The most remarkable exception is n = 83, which has an orbit of 16180 + 30 elements. A few other small numbers (141, 147, 151, 161, 166, 185, ...) merge within a few steps into the same trajectory (cf. examples), and have an orbit of roughly the same size. See A293979 for more about the trajectory of 83. %C A293980 The number n = 443 is another exception, with a(n) = 9066, and a trajectory that merges into that of 83 only after 8853 iterations, cf. A293978. %C A293980 The numbers 418 -> 209 -> 870 -> 435 -> ... also have a comparatively large orbit of about 940 + 30 elements, completely disjoint from that of 83 apart from the loop (which is entered at the value 60, while the orbit of 83 enters it at 26). %H A293980 M. F. Hasler, <a href="/A293980/b293980.txt">Table of n, a(n) for n = 0..199</a> %H A293980 Eric Angelini, <a href="http://www.cetteadressecomportecinquantesignes.com/PrimeLatz.htm">The PrimeLatz conjecture</a> %e A293980 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). %e A293980 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. %e A293980 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. %t A293980 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 *) %o A293980 (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.) %o A293980 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.) %Y A293980 Cf. A174221 (main entry), A174223. %Y A293980 Cf. A193230 (orbit of 1), A293979 (orbit of 83), A293978 (orbit of 443). %K A293980 nonn %O A293980 0,3 %A A293980 _M. F. Hasler_, Oct 25 2017