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 A350657 #7 Jan 24 2022 16:12:09 %S A350657 0,2,2,6,6,6,6,8,8,14,14,14,14,16,14,15,16,17,18,20,20,24,24,24,24,26, %T A350657 26,32,32,32,32,44,32,44,44,44,44,44,44,44,44,44,44,44,44,45,46,47,48, %U A350657 50,50,51,52,53,54,56,56,60,60,60,60,62,62,68,68,68,68 %N A350657 a(n) is the greatest value of the orbit of n under repeated application of A350229 (the sum of a number and its balanced ternary digits). %C A350657 The sequence { a(n) - n, n >= 0 } has no upper limit (this because the sequence A065363 can be positive on arbitrarily large intervals). %e A350657 For n = 9: %e A350657 - the orbit of 9 contains the following values: %e A350657 k v bter(v) ds(v) %e A350657 - -- ------- ----- %e A350657 0 9 100 1 %e A350657 1 10 101 2 %e A350657 2 12 110 2 %e A350657 3 14 1TTT -2 %e A350657 4 12 110 2 %e A350657 - so a(9) = max({ 9, 10, 12, 14 }) = 14. %t A350657 f[n_] := n + Total[If[First@ # == 0, Rest@ #, #] &[Prepend[IntegerDigits[n, 3], 0] //. {x___, y_, k_ /; k > 1, z___} :> {x, y + 1, k - 3, z}]]; Array[Max@ NestWhileList[f, #, UnsameQ, All] &, 67, 0] (* _Michael De Vlieger_, Jan 15 2022 *) %o A350657 (PARI) b(n) = my (v=n, d); while (n, n=(n-d=[0,1,-1][1+n%3])/3; v+=d); v %o A350657 a(n) = my (s=[]); while (!setsearch(s, n), s=setunion(s, [n]); n=b(n)); s[#s] %Y A350657 Cf. A350229, A350656. %K A350657 nonn,base %O A350657 0,2 %A A350657 _Rémy Sigrist_, Jan 10 2022