login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 56th year, we are closing in on 350,000 sequences, and we’ve crossed 9,700 citations (which often say “discovered thanks to the OEIS”).

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

Table of n, a(n) for n=0..34.

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

Cf. A034967, A037123, A114136.

Sequence in context: A129483 A075890 A119977 * A075316 A192142 A212962

Adjacent sequences:  A319730 A319731 A319732 * A319734 A319735 A319736

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 | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified December 1 16:44 EST 2021. Contains 349430 sequences. (Running on oeis4.)