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 A343228 #14 Apr 09 2021 11:37:47 %S A343228 0,1,2,2,3,4,4,5,4,4,5,6,6,7,8,8,9,8,8,9,10,10,11,8,8,9,8,8,9,10,10, %T A343228 11,12,12,13,12,12,13,14,14,15,16,16,17,16,16,17,18,18,19,16,16,17,16, %U A343228 16,17,18,18,19,20,20,21,20,20,21,22,22,23,16,16,17,16 %N A343228 A binary encoding of the digits "+1" in balanced ternary representation of n. %C A343228 The ones in the binary representation of a(n) correspond to the digits "+1" in the balanced ternary representation of n. %C A343228 We can extend this sequence to negative indices: a(-n) = A343229(n) for any n >= 0. %H A343228 Rémy Sigrist, <a href="/A343228/b343228.txt">Table of n, a(n) for n = 0..6561</a> %H A343228 Rémy Sigrist, <a href="/A343228/a343228.png">Scatterplot of (a(n), A343229(n)) for n = 0..3^10</a> %H A343228 Wikipedia, <a href="https://en.wikipedia.org/wiki/Balanced_ternary">Balanced ternary</a> %F A343228 a(n) = A289831(A060372(n)). %e A343228 The first terms, alongside the balanced ternary representation of n (with "T" instead of digits "-1") and the binary representation of a(n), are: %e A343228 n a(n) ter(n) bin(a(n)) %e A343228 -- ---- ------ --------- %e A343228 0 0 0 0 %e A343228 1 1 1 1 %e A343228 2 2 1T 10 %e A343228 3 2 10 10 %e A343228 4 3 11 11 %e A343228 5 4 1TT 100 %e A343228 6 4 1T0 100 %e A343228 7 5 1T1 101 %e A343228 8 4 10T 100 %e A343228 9 4 100 100 %e A343228 10 5 101 101 %e A343228 11 6 11T 110 %e A343228 12 6 110 110 %e A343228 13 7 111 111 %e A343228 14 8 1TTT 1000 %e A343228 15 8 1TT0 1000 %o A343228 (PARI) a(n) = { my (v=0, b=1, t); while (n, t=centerlift(Mod(n, 3)); if (t==+1, v+=b); n=(n-t)\3; b*=2); v } %Y A343228 Cf. A059095, A060372, A140267, A289813, A289831, A343229, A343230, A343231. %K A343228 nonn,look,base %O A343228 0,3 %A A343228 _Rémy Sigrist_, Apr 08 2021