# 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)
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.7914096117019653, "perplexity": 351.2787571978741}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2021-10/segments/1614178358956.39/warc/CC-MAIN-20210227114444-20210227144444-00433.warc.gz"}