A180018 Difference of sums of digits of n in decimal and in binary representation.
0, 0, 1, 1, 3, 3, 4, 4, 7, 7, -1, -1, 1, 1, 2, 2, 6, 6, 7, 7, 0, 0, 1, 1, 4, 4, 5, 5, 7, 7, -1, -1, 4, 4, 5, 5, 7, 7, 8, 8, 2, 2, 3, 3, 5, 5, 6, 6, 10, 10, 2, 2, 4, 4, 5, 5, 8, 8, 9, 9, 2, 2, 3, 3, 9, 9, 10, 10, 12, 12, 4, 4, 7, 7, 8, 8, 10, 10, 11, 11, 6, 6, 7, 7, 9, 9, 10, 10, 13, 13, 5, 5, 7, 7, 8, 8
Offset: 0
Links
Crossrefs
Programs
-
Mathematica
Table[Total[IntegerDigits[n]]-Total[IntegerDigits[n,2]],{n,0,100}] (* Harvey P. Dale, Dec 27 2015 *)
-
PARI
a(n) = sumdigits(n) - hammingweight(n); \\ Michel Marcus, Nov 06 2022