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.
%I A319733 #24 Nov 09 2018 20:40:59 %S A319733 1,3,10,36,73,177,460,1083,2395,5616,13645,28410,61237,139332,288640, %T A319733 617238,1349299,2868414,5996665,12814005,28009981,57356550,119204515, %U A319733 256361433,523470583,1084937169,2295828010,4741694379,9785380105,20385048345,43120114795,87517507827,180053228620,379360852038,769412529055 %N A319733 a(n) is the sum of the digits of all positive integers k <= 2^n. %C A319733 Inspired by A114136. %e A319733 a(0) = 1; %e A319733 a(1) = 3 = 1+2; %e A319733 a(2) = 10 = 1+2+3+4; %e A319733 a(3) = 36 = 1+2+3+4+5+6+7+8; %e A319733 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); %e A319733 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. %t A319733 k = s = 0; lst = {}; Do[ While[k <= 2^n, s = s + Plus @@ IntegerDigits@ k; k++]; AppendTo[lst, s], {n, 0, 32}] (* slow, or *) %t A319733 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. *) %t A319733 g[n_, b_: 10] := Plus @@ ((f[n, #, b] & /@ Range[b - 1])*Range[b - 1]); Array[ g[2^#] &, 33, 0] %o A319733 (PARI) a(n) = sum(k=0, 2^n, sumdigits(k)); \\ _Michel Marcus_, Sep 27 2018 %Y A319733 Cf. A034967, A037123, A114136. %K A319733 base,nonn %O A319733 0,2 %A A319733 Joseph K. Horn and _Robert G. Wilson v_, Sep 26 2018