login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

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