login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A319733 a(n) is the sum of the digits of all positive integers k <= 2^n. 0
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 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,2
COMMENTS
Inspired by A114136.
LINKS
EXAMPLE
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.
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<d<b, appears in the integers 1 to n in base b. The count for d=0 is incorrect. *)
g[n_, b_: 10] := Plus @@ ((f[n, #, b] & /@ Range[b - 1])*Range[b - 1]); Array[ g[2^#] &, 33, 0]
PROG
(PARI) a(n) = sum(k=0, 2^n, sumdigits(k)); \\ Michel Marcus, Sep 27 2018
CROSSREFS
Sequence in context: A351011 A351009 A119977 * A075316 A192142 A212962
KEYWORD
base,nonn
AUTHOR
Joseph K. Horn and Robert G. Wilson v, Sep 26 2018
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 16 17:36 EDT 2024. Contains 371749 sequences. (Running on oeis4.)