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 A353310 #8 Apr 14 2022 08:53:12 %S A353310 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, %T A353310 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, %U A353310 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 %N 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. %F A353310 a(n) = A353311(n) - A353312(n). %e A353310 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. %e A353310 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. %o A353310 (PARI) %o A353310 A353313(n) = { my(r=(n%3)); if(!r,n/3,((5*((n-r)/3)) + r + 3)); }; %o A353310 A353310(n) = { my(visited = Map(), p); for(j=0, oo, if(mapisdefined(visited, n, &p), return(p), mapput(visited, n, j)); n = A353313(n)); }; %Y A353310 Cf. A353311, A353312, A353313. %K A353310 nonn %O A353310 0,7 %A A353310 _Antti Karttunen_, Apr 14 2022