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.

Previous Showing 11-11 of 11 results.

A319733 a(n) is the sum of the digits of all positive integers k <= 2^n.

Original entry on oeis.org

1, 3, 10, 36, 73, 177, 460, 1083, 2395, 5616, 13645, 28410, 61237, 139332, 288640, 617238, 1349299, 2868414, 5996665, 12814005, 28009981, 57356550, 119204515, 256361433, 523470583, 1084937169, 2295828010, 4741694379, 9785380105, 20385048345, 43120114795, 87517507827, 180053228620, 379360852038, 769412529055
Offset: 0

Views

Author

Joseph K. Horn and Robert G. Wilson v, Sep 26 2018

Keywords

Comments

Inspired by A114136.

Examples

			a(0) = 1;
a(1) = 3 = 1+2;
a(2) = 10 = 1+2+3+4;
a(3) = 36 = 1+2+3+4+5+6+7+8;
a(4) = 73 = 1+2+3+4+5+6+7+8+9+(1+0)+(1+1)+(1+2)+(1+3)+(1+4)+(1+5)+(1+6);
a(5) = 177 = 1+2+3+4+5+6+7+8+9+(1+0)+(1+1)+(1+2)+(1+3)+(1+4)+(1+5)+(1+6)+(1+7)+(1+8)+(1+9)+(2+0)+(2+1)+(2+2)+(2+3)+(2+4)+(2+5)+(2+6)+(2+7)+(2+8)+(2+9)+(3+0)+(3+1)+(3+2); etc.
		

Crossrefs

Programs

  • Mathematica
    k = s = 0; lst = {}; Do[ While[k <= 2^n, s = s + Plus @@ IntegerDigits@ k; k++]; AppendTo[lst, s], {n, 0, 32}] (* slow, or *)
    f[n_, d_ /; d > 0, b_: 10] := Sum[k = n + 1; j = Mod[Floor[k/b^i], b]; j*i*b^(i - 1) + Mod[k, b^i]*Boole[j == d] + b^i*Boole[j > d > 0], {i, 0, Log[b, k]}]; (* calculates the number of times the digit, 0
    				
  • PARI
    a(n) = sum(k=0, 2^n, sumdigits(k)); \\ Michel Marcus, Sep 27 2018
Previous Showing 11-11 of 11 results.