login
A229745
a(n) = wt(n+wt(n))-wt(n), where wt(n) is the binary weight of n, A000120(n).
1
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, -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, -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
OFFSET
0,14
COMMENTS
For any positive or negative integer m, there are infinitely many positive integers n such that a(n) = m. [Stolarsky]
LINKS
Kenneth B. Stolarsky, The sum of a digitaddition series, Proc. Amer. Math. Soc. 59 (1976), no. 1, 1--5. MR0409340 (53 #13099)
MATHEMATICA
f[n_] := DigitCount[n, 2, 1]; Table[f[n + f@ n] - f@ n, {n, 120}] (* Michael De Vlieger, Apr 04 2015 *)
PROG
(PARI) a(n) = hammingweight(n+hammingweight(n)) - hammingweight(n); \\ Michel Marcus, Apr 04 2015
CROSSREFS
Sequence in context: A269242 A321759 A076882 * A339366 A016397 A238450
KEYWORD
sign
AUTHOR
N. J. A. Sloane, Oct 08 2013
STATUS
approved