%I #26 Jul 23 2023 06:08:25
%S 2,1,3,2,4,3,2,1,3,2,4,3,5,4,3,2,4,3,5,4,6,5,4,3,5,4,3,2,4,3,2,1,3,2,
%T 4,3,5,4,3,2,4,3,5,4,6,5,4,3,5,4,6,5,7,6,5,4,6,5,4,3,5,4,3,2,4,3,5,4,
%U 6,5,4,3,5,4,6,5,7,6,5,4,6,5,7,6,8,7,6
%N Number of 1's in the base-(-2) expansion of -n.
%C Number of 1's in A212529(n).
%C Define f(n) as: f(0) = 0, f(-2*n) = f(n), f(-2*n+1) = f(n) + 1, then a(n) = f(-n), n >= 1. See A027615 for the other half of f.
%C For k > 1, the earliest occurrence of k is n = A086893(k-1).
%H Jianing Song, <a href="/A320642/b320642.txt">Table of n, a(n) for n = 1..10000</a>
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/Negabinary.html">Negabinary</a>.
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/Negadecimal.html">Negadecimal</a>.
%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Negative_base">Negative base</a>.
%F a(n) == -n (mod 3).
%F a(n) = A000120(A005352(n)). - _Michel Marcus_, Oct 23 2018
%e A212529(11) = 110101 which has four 1's, so a(11) = 4.
%e A212529(25) = 111011 which has five 1's, so a(25) = 5.
%e A212529(51) = 11011101 which has six 1's, so a(51) = 6.
%t b[n_] := b[n] = b[Quotient[n - 1, -2]] + Mod[n, 2]; b[0] = 0; a[n_] := b[-n]; Array[a, 100] (* _Amiram Eldar_, Jul 23 2023 *)
%o (PARI) b(n) = if(n==0, 0, b(n\(-2))+n%2)
%o a(n) = b(-n)
%Y Cf. A000120, A005352, A027615, A086893, A212529.
%K nonn,base
%O 1,1
%A _Jianing Song_, Oct 18 2018