%I #13 Apr 09 2021 11:38:23
%S 0,0,1,0,0,3,2,2,1,0,0,1,0,0,7,6,6,5,4,4,5,4,4,3,2,2,1,0,0,1,0,0,3,2,
%T 2,1,0,0,1,0,0,15,14,14,13,12,12,13,12,12,11,10,10,9,8,8,9,8,8,11,10,
%U 10,9,8,8,9,8,8,7,6,6,5,4,4,5,4,4,3,2,2,1,0
%N A binary encoding of the digits "-1" in balanced ternary representation of n.
%C The ones in the binary representation of a(n) correspond to the digits "-1" in the balanced ternary representation of n.
%C We can extend this sequence to negative indices: a(-n) = A343228(n) for any n >= 0.
%H Rémy Sigrist, <a href="/A343229/b343229.txt">Table of n, a(n) for n = 0..6561</a>
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Balanced_ternary">Balanced ternary</a>
%F a(n) = A289831(A060373(n)).
%e 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 n a(n) ter(n) bin(a(n))
%e -- ---- ------ ---------
%e 0 0 0 0
%e 1 0 1 0
%e 2 1 1T 1
%e 3 0 10 0
%e 4 0 11 0
%e 5 3 1TT 11
%e 6 2 1T0 10
%e 7 2 1T1 10
%e 8 1 10T 1
%e 9 0 100 0
%e 10 0 101 0
%e 11 1 11T 1
%e 12 0 110 0
%e 13 0 111 0
%e 14 7 1TTT 111
%e 15 6 1TT0 110
%o (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 Cf. A059095, A060373, A140267, A289814, A289831, A343228, A343230, A343231, A005836 (indices of 0's).
%K nonn,look,base
%O 0,6
%A _Rémy Sigrist_, Apr 08 2021