Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #8 Apr 14 2022 08:53:12
%S 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 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 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 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 a(n) = A353311(n) - A353312(n).
%e 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 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 (PARI)
%o A353313(n) = { my(r=(n%3)); if(!r,n/3,((5*((n-r)/3)) + r + 3)); };
%o 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 Cf. A353311, A353312, A353313.
%K nonn
%O 0,7
%A _Antti Karttunen_, Apr 14 2022