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 A343317 #8 Apr 12 2021 01:36:41 %S A343317 0,1,4,2,4,13,11,13,7,5,7,13,11,13,40,38,40,34,32,34,40,38,40,22,20, %T A343317 22,16,14,16,22,20,22,40,38,40,34,32,34,40,38,40,121,119,121,115,113, %U A343317 115,121,119,121,103,101,103,97,95,97,103,101,103,121,119,121 %N A343317 a(n) is the least k >= 0 such that A343316(n, k) = n. %C A343317 To compute a(n): in the balanced ternary representation of n, replace each nonzero digit by "+1" and each nonleading zero by "-1". %H A343317 Rémy Sigrist, <a href="/A343317/b343317.txt">Table of n, a(n) for n = 0..6561</a> %e A343317 The first terms, alongside their balanced ternary representation (with "T" instead of digits "-1"), are: %e A343317 n a(n) bter(n) bter(a(n)) %e A343317 -- ---- ------- ---------- %e A343317 0 0 0 0 %e A343317 1 1 1 1 %e A343317 2 4 1T 11 %e A343317 3 2 10 1T %e A343317 4 4 11 11 %e A343317 5 13 1TT 111 %e A343317 6 11 1T0 11T %e A343317 7 13 1T1 111 %e A343317 8 7 10T 1T1 %e A343317 9 5 100 1TT %e A343317 10 7 101 1T1 %e A343317 11 13 11T 111 %e A343317 12 11 110 11T %e A343317 13 13 111 111 %e A343317 14 40 1TTT 1111 %e A343317 15 38 1TT0 111T %o A343317 (PARI) a(n) = if (n==0, 0, my (d=centerlift(Mod(n, 3))); if (d, +1, -1) + 3*a((n-d)\3)) %Y A343317 Cf. A343316, A343231. %K A343317 nonn,base %O A343317 0,3 %A A343317 _Rémy Sigrist_, Apr 11 2021