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 A343312 #16 Apr 15 2021 15:24:19 %S A343312 0,1,2,4,3,5,13,6,11,7,12,8,10,9,14,40,15,38,16,39,17,34,20,37,18,32, %T A343312 22,33,21,35,19,36,23,31,24,29,25,30,26,28,27,41,121,42,119,43,120,44, %U A343312 115,47,118,45,113,49,114,48,116,46,117,50,103,59,112,51,101 %N A343312 Lexicographically earliest sequence of distinct nonnegative integers such that for any n >= 0, the digits "-1" in the balanced ternary representation of a(n) correspond to digits "+1" in that of a(n+1). %C A343312 This sequence is a permutation of the nonnegative integers (with inverse A343313): %C A343312 - we can always extend the sequence with a member of A003462 sufficiently large, %C A343312 - so the sequence is infinite and unbounded, %C A343312 - once we have a k-digit number and before introducing a number with more than k digits, we must use A003462(k), %C A343312 - so we have infinitely many terms of A003462 in this sequence, %C A343312 - for any m with k digits, we have infinitely many terms of A003462 > m in the sequence, each of these terms can be followed by m, so m must eventually appear. %C A343312 Apparently: %C A343312 - the sequence preserves the number of digits in balanced ternary representation (A134021), %C A343312 - fixed points correspond to 0 and A007051. %H A343312 Rémy Sigrist, <a href="/A343312/b343312.txt">Table of n, a(n) for n = 0..9842</a> %H A343312 Rémy Sigrist, <a href="/A343312/a343312.png">Scatterplot of the sequence for n = 0..3^9</a> %H A343312 Rémy Sigrist, <a href="/A343312/a343312.gp.txt">PARI program for A343312</a> %H A343312 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %F A343312 A343229(a(n)) AND A343228(a(n+1)) = A343228(a(n+1)) (where AND denotes the bitwise AND operator). %e A343312 The first terms, alongside their balanced ternary representation (with "T" instead of digits "-1"), are: %e A343312 n a(n) bter(a(a)) %e A343312 -- ---- ---------- %e A343312 0 0 0 %e A343312 1 1 1 %e A343312 2 2 1T %e A343312 3 4 11 %e A343312 4 3 10 %e A343312 5 5 1TT %e A343312 6 13 111 %e A343312 7 6 1T0 %e A343312 8 11 11T %e A343312 9 7 1T1 %e A343312 10 12 110 %e A343312 11 8 10T %e A343312 12 10 101 %e A343312 13 9 100 %e A343312 14 14 1TTT %e A343312 15 40 1111 %e A343312 16 15 1TT0 %e A343312 17 38 111T %o A343312 (PARI) See Links section. %Y A343312 Cf. A003462, A007051, A134021, A343228, A343229, A343313 (inverse). %K A343312 nonn,base,look %O A343312 0,3 %A A343312 _Rémy Sigrist_, Apr 11 2021