cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A180018 Difference of sums of digits of n in decimal and in binary representation.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Aug 06 2010

Keywords

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

Formula

a(n) = A007953(n) - A000120(n);
a(A037308(n)) = 0;
a(A011557(n)) = 1 - A000120(A011557(n));
a(A000079(n)) = A007953(A000079(n)) - 1;
a(A002283(n)) = A008591(n) - A000120(A002283(n));
a(A000225(n)) = A007953(A000225(n)) - n.