login
A353310
Number of terms encountered when iterating A353313, before reaching the first term that is a part of a finite cycle, or -1 if no finite cycle is ever reached.
4
0, 0, 1, 0, 0, 0, 2, 2, 1, 0, 0, 1, 1, 3, 1, 0, 0, 2, 3, 0, 0, 3, 5, 0, 2, 0, 1, 1, 0, 0, 1, 5, 7, 2, 0, 0, 2, 11, 13, 4, 0, 51, 2, 54, 0, 0, 4, 1, 0, 0, 0, 3, 3, 3, 4, 6, 6, 1, 4, 0, 0, 12, 2, 4, 10, 12, 6, 15, 15, 0, 50, 2, 3, 18, 53, 0, 56, 21, 2, 3, 0, 2, 5, 19, 0, 0, 62, 1, 59, 2, 2, 27, 65, 6, 5, 5, 8, 90, 8
OFFSET
0,7
FORMULA
a(n) = A353311(n) - A353312(n).
EXAMPLE
For n = 1, when iterating with A353313, we obtain 1 -> 4 -> 9 -> 3 -> 1 -> etc, thus 1 itself is included in the closed cycle, and therefore a(1) = 0.
For n = 6, when iterating with A353313, we obtain 6 -> 2 -> 5 -> ..., and after 103 more iterations we obtain 5 again (see examples in A353311 and A353312), thus only the two initial numbers, 6 and 2 are outside of the final closed cycle, therefore a(6) = 2.
PROG
(PARI)
A353313(n) = { my(r=(n%3)); if(!r, n/3, ((5*((n-r)/3)) + r + 3)); };
A353310(n) = { my(visited = Map(), p); for(j=0, oo, if(mapisdefined(visited, n, &p), return(p), mapput(visited, n, j)); n = A353313(n)); };
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Apr 14 2022
STATUS
approved