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 A353649 #8 May 03 2022 16:51:43 %S A353649 0,1,2,6,3,5,4,8,15,9,14,10,17,7,18,11,16,12,19,50,13,23,45,24,44,25, %T A353649 47,27,41,28,42,26,43,29,46,30,51,20,52,21,53,22,54,31,59,153,32,48, %U A353649 33,49,35,55,36,56,34,57,37,68,39,69,38,70,134,40,71,132,72 %N A353649 Lexicographically earliest sequence of distinct nonnegative integers such that two consecutive terms can be added without carries in balanced ternary. %C A353649 Two integers can be added without carries in balanced ternary if they have no equal nonzero digit at the same position. %C A353649 This sequence is a permutation of the nonnegative integers with inverse A353650. %H A353649 Rémy Sigrist, <a href="/A353649/b353649.txt">Table of n, a(n) for n = 0..10000</a> %H A353649 Wikipedia, <a href="https://en.wikipedia.org/wiki/Balanced_ternary">Balanced ternary</a> %H A353649 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %e A353649 The first terms, in decimal and in balanced ternary, are: %e A353649 n a(n) bter(a(n)) %e A353649 -- ---- ---------- %e A353649 0 0 0 %e A353649 1 1 1 %e A353649 2 2 1T %e A353649 3 6 1T0 %e A353649 4 3 10 %e A353649 5 5 1TT %e A353649 6 4 11 %e A353649 7 8 10T %e A353649 8 15 1TT0 %e A353649 9 9 100 %e A353649 10 14 1TTT %e A353649 11 10 101 %e A353649 12 17 1T0T %e A353649 13 7 1T1 %e A353649 14 18 1T00 %o A353649 (PARI) ok(u, v) = { while (u && v, my (uu=[0, +1, -1][1+u%3], vv=[0, +1, -1][1+v%3]); if (abs(uu+vv)>1, return (0)); u=(u-uu)/3; v=(v-vv)/3); 1 } %o A353649 { s=0; v=0; for (n=0, 66, print1 (v", "); s+=2^v; for (w=0, oo, if (!bittest(s,w) && ok(v,w), v=w; break))) } %Y A353649 Cf. A059095, A109812 (binary analog), A353648, A353650 (inverse). %K A353649 nonn,look,base %O A353649 0,3 %A A353649 _Rémy Sigrist_, May 01 2022