OFFSET
0,3
COMMENTS
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.
The trajectory of all positive numbers considered so far enters this loop.
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).
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.
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.
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.
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).
LINKS
M. F. Hasler, Table of n, a(n) for n = 0..199
Eric Angelini, The PrimeLatz conjecture
EXAMPLE
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.
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 *)
PROG
(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.)
CROSSREFS
KEYWORD
nonn
AUTHOR
M. F. Hasler, Oct 25 2017
STATUS
approved