# Number of 1 in binary representation of n

Let $1(n)$ be the number of digits $1$ in binary representation of number $n$.

For example, $13=1101_2$ so $1(13)=3\\$

Is there explicit form of $\,\,\sum{1(i)x^i}$?

• Your version is missing $1(4)=1$ – Henry Mar 25 '14 at 22:56
The generating function you ask about, more typically written as $\sum_{i\ge 0} s_2(i) x^i$, can be expressed as $$\frac{1}{1-x} \sum_{m\ge 0} \frac{x^{2^m}}{1+x^{2^m}}$$ The number of 1's in the binary expansion is just the sums of digits; there also exists a generalization for sums of digits function in other bases. For details, references and further information, see for example "Generating Functions for the Digital Sum and Other Digit Counting Sequences" by Adams-Watters and Ruskey (Journal of Integer Sequences, 2009)