login
a(n) = wt(n+wt(n))-wt(n), where wt(n) is the binary weight of n, A000120(n).
1

%I #13 Apr 04 2015 16:33:34

%S 0,0,1,0,1,1,-1,-1,1,1,0,0,1,-2,-1,-1,1,1,0,0,1,-1,0,0,1,0,1,1,2,-2,

%T -2,-3,1,1,0,0,1,-1,0,0,1,0,1,1,2,-1,-1,-2,1,0,1,1,2,0,0,-1,2,1,1,-4,

%U -3,-3,-2,-3,1,1,0,0,1,-1,0,0,1,0,1,1,2,-1,-1,-2,1,0,1,1,2,0,0,-1,2,1,1,-3,-2,-2,-1,-2

%N a(n) = wt(n+wt(n))-wt(n), where wt(n) is the binary weight of n, A000120(n).

%C For any positive or negative integer m, there are infinitely many positive integers n such that a(n) = m. [Stolarsky]

%H N. J. A. Sloane, <a href="/A229745/b229745.txt">Table of n, a(n) for n = 0..10000</a>

%H Kenneth B. Stolarsky, <a href="http://dx.doi.org/10.1090/S0002-9939-1976-0409340-X">The sum of a digitaddition series</a>, Proc. Amer. Math. Soc. 59 (1976), no. 1, 1--5. MR0409340 (53 #13099)

%t f[n_] := DigitCount[n, 2, 1]; Table[f[n + f@ n] - f@ n, {n, 120}] (* _Michael De Vlieger_, Apr 04 2015 *)

%o (PARI) a(n) = hammingweight(n+hammingweight(n)) - hammingweight(n); \\ _Michel Marcus_, Apr 04 2015

%Y Cf. A000120, A010062.

%K sign

%O 0,14

%A _N. J. A. Sloane_, Oct 08 2013