cp's OEIS Frontend

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.

A353309 The maximum sum of base-3 digits occurring among all numbers reached after n, when iterating map x -> A353313(x) starting from x=n, or -1 if no finite cycle is ever reached.

Original entry on oeis.org

0, 2, 18, 2, 2, 18, 18, 6, 18, 2, 18, 5, 2, 18, 6, 18, 6, 18, 18, 18, 5, 6, 18, 5, 18, 6, 18, 2, 5, 6, 18, 18, 18, 5, 18, 5, 2, 6, 18, 18, 5, 13, 6, 13, 6, 18, 8, 18, 6, 5, 6, 18, 6, 18, 18, 18, 8, 18, 5, 18, 5, 18, 5, 6, 6, 18, 18, 18, 8, 5, 13, 5, 18, 18, 13, 6, 13, 18, 18, 8, 18, 2, 18, 18, 5, 6, 13, 6, 13, 6
Offset: 0

Views

Author

Antti Karttunen, Apr 13 2022

Keywords

Examples

			When starting iterating A353313 from n=7, we obtain -> 14 -> 25 -> 44 -> 75 -> 25 -> 44 -> 75 -> 25 -> etc, ad infinitum. Applying A053735 to all distinct terms encountered after 7, that is [14, 25, 44, 75] gives us base-3 digit sums [4, 5, 6, 5], therefore a(7) = 6, which is the largest sum.
		

Crossrefs

Cf. also A352895.

Programs

  • PARI
    A053735(n) = sumdigits(n, 3);
    A353313(n) = { my(r=(n%3)); if(!r,n/3,((5*((n-r)/3)) + r + 3)); };
    A353309(n) = { my(visited = Map(), m=0); for(j=1, oo, n = A353313(n); m=max(m,A053735(n)); if(mapisdefined(visited, n), return(m), mapput(visited, n, j))); };