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 A341054 #12 Apr 25 2021 15:12:29 %S A341054 0,1,3,4,2,8,9,10,12,13,11,7,5,6,25,23,24,26,27,28,30,31,29,35,36,37, %T A341054 39,40,38,34,32,33,21,22,20,16,14,15,17,18,19,75,76,74,70,68,69,71,72, %U A341054 73,79,77,78,80,81,82,84,85,83,89,90,91,93,94,92,88,86,87 %N A341054 For any number n with balanced ternary expansion (d_1, ..., d_k), the balanced ternary expansion of a(n), say (t_1, ..., t_k), satisfies t_m = d_1 + ... + d_m mod 3 for m = 1..k. %C A341054 This sequence is similar to A006068. %C A341054 This sequence is a permutation of the nonnegative integers with inverse A341055. %H A341054 Rémy Sigrist, <a href="/A341054/b341054.txt">Table of n, a(n) for n = 0..9841</a> %H A341054 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %e A341054 The first terms, alongside their balanced ternary expansion (with T's standing for -1's), are: %e A341054 n a(n) bter(n) bter(a(n)) %e A341054 -- ---- ------- ---------- %e A341054 0 0 0 0 %e A341054 1 1 1 1 %e A341054 2 3 1T 10 %e A341054 3 4 10 11 %e A341054 4 2 11 1T %e A341054 5 8 1TT 10T %e A341054 6 9 1T0 100 %e A341054 7 10 1T1 101 %e A341054 8 12 10T 110 %e A341054 9 13 100 111 %e A341054 10 11 101 11T %e A341054 11 7 11T 1T1 %e A341054 12 5 110 1TT %e A341054 13 6 111 1T0 %e A341054 14 25 1TTT 10T1 %e A341054 15 23 1TT0 10TT %e A341054 16 24 1TT1 10T0 %o A341054 (PARI) a(n) = { my (d=[], s=Mod(0, 3)); while (n, my (t=centerlift(Mod(n, 3))); n=(n-t)\3; d=concat(t, d)); for (k=1, #d, d[k] = centerlift(s+=d[k])); fromdigits(d, 3) } %Y A341054 Cf. A006068, A059095, A341055 (inverse). %K A341054 nonn,base %O A341054 0,3 %A A341054 _Rémy Sigrist_, Apr 25 2021