login

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 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

a(n) = a(n-1) + sum of digits of n.
33

%I #77 Jan 05 2025 19:51:35

%S 0,1,3,6,10,15,21,28,36,45,46,48,51,55,60,66,73,81,90,100,102,105,109,

%T 114,120,127,135,144,154,165,168,172,177,183,190,198,207,217,228,240,

%U 244,249,255,262,270,279,289,300,312,325,330,336,343,351,360,370,381

%N a(n) = a(n-1) + sum of digits of n.

%C Sum of digits of A007908(n). - _Franz Vrabec_, Oct 22 2007

%C Also digital sum of A138793(n) for n > 0. - _Bruno Berselli_, May 27 2011

%C Sum of the digital sum of i for i from 0 to n. - _N. J. A. Sloane_, Nov 13 2013

%D N. Agronomof, Sobre una función numérica, Revista Mat. Hispano-Americana 1 (1926), 267-269.

%D Maurice d'Ocagne, Sur certaines sommations arithmétiques, J. Sciencias Mathematicas e Astronomicas 7 (1886), 117-128.

%H David A Corneth, <a href="/A037123/b037123.txt">Table of n, a(n) for n = 0..10008</a>

%H P.-H. Cheo and S.-C. Yien, <a href="https://actamath.cjoe.ac.cn/Jwk_sxxb_cn/EN/10.12386/A1955sxxb0033">A problem on the k-adic representation of positive integers</a>, Acta Math. Sinica 5, 433-438 (1955).

%H J. Coquet, <a href="http://dx.doi.org/10.1016/0022-314X(86)90067-3">Power sums of digital sums</a>, J. Number Theory 22 (1986), no. 2, 161-176.

%H H. Delange, <a href="http://dx.doi.org/10.5169/seals-47328">Sur la fonction sommatoire de la fonction "somme des chiffres"</a>, Enseignement Math. (2) 21 (1975), 31-47.

%H P. J. Grabner, P. Kirschenhofer, H. Prodinger and R. F. Tichy, <a href="https://doi.org/10.1007/978-94-011-2058-6_25">On the moments of the sum-of-digits function</a>, Applications of Fibonacci numbers, Vol. 5 (St. Andrews, 1992), Kluwer Acad. Publ., Dordrecht, 1993, 263-271.

%H Hsien-Kuei Hwang, S. Janson, and T.-H. Tsai, <a href="http://140.109.74.92/hk/wp-content/files/2016/12/aat-hhrr-1.pdf">Exact and asymptotic solutions of the recurrence f(n) = f(floor(n/2)) + f(ceiling(n/2)) + g(n): theory and applications</a>, Preprint 2016.

%H Hsien-Kuei Hwang, S. Janson, and T.-H. Tsai, <a href="https://doi.org/10.1145/3127585">Exact and Asymptotic Solutions of a Divide-and-Conquer Recurrence Dividing at Half: Theory and Applications</a>, ACM Transactions on Algorithms, 13:4 (2017), #47; DOI: 10.1145/3127585.

%H J.-L. Mauclaire and Leo Murata, <a href="http://dx.doi.org/10.3792/pjaa.59.274">On q-additive functions</a>, I. Proc. Japan Acad. Ser. A Math. Sci. 59 (1983), no. 6, 274-276.

%H J.-L. Mauclaire and Leo Murata, <a href="http://dx.doi.org/10.3792/pjaa.59.441">On q-additive functions</a>, II. Proc. Japan Acad. Ser. A Math. Sci. 59 (1983), no. 9, 441-444.

%H H. Riede, <a href="https://web.archive.org/web/2024*/https://www.fq.math.ca/Scanned/36-1/riede.pdf">Asymptotic estimation of a sum of digits</a>, Fibonacci Q. 36, No. 1, 72-75 (1998).

%H J. R. Trollope, <a href="http://www.jstor.org/stable/2687954">An explicit expression for binary digital sums</a>, Math. Mag. 41 1968 21-25.

%F a(n) = Sum_{k=0..n} s(k) = Sum_{k=0..n} A007953(k), where s(k) denote the sum of the digits of k in decimal representation. Asymptotic expression: a(n-1) = Sum_{k=0..n-1} s(k) = 4.5*n*log_10(n) + O(n). - Antonio G. Astudillo (afg_astudillo(AT)hotmail.com), Sep 07 2002

%F a(n) = n*(n+1)/2 - 9*Sum_{k=1..n} Sum_{i=1..ceiling(log_10(k))} floor(k/10^i). - _Benoit Cloitre_, Aug 28 2003

%F From _Hieronymus Fischer_, Jul 11 2007: (Start)

%F G.f.: Sum_{k>=1} ((x^k - x^(k+10^k) - 9x^(10^k))/(1-x^(10^k)))/(1-x)^2.

%F a(n) = (1/2)*((n+1)*(n - 18*Sum_{k>=1} floor(n/10^k)) + 9*Sum_{k>=1} (1 + floor(n/10^k))*floor(n/10^k)*10^k).

%F a(n) = (1/2)*((n+1)*(2*A007953(n)-n) + 9*Sum_{k>=1} (1+floor(n/10^k))*floor(n/10^k)*10^k). (End)

%F a(n) = A007953(A053064(n)). - _Reinhard Zumkeller_, Oct 10 2008

%F From _Wojciech Raszka_, Jun 14 2019: (Start)

%F a(10^k - 1) = 10*a(10^(k - 1) - 1) + 45*10^(k - 1) for k > 0.

%F a(n) = a(n mod m) + MSD*a(m - 1) + (MSD*(MSD - 1)/2)*m + MSD*((n mod m) + 1), where m = 10^(A055642(n) - 1), MSD = A000030(n). (End)

%p # From _N. J. A. Sloane_, Nov 13 2013:

%p digsum:=proc(n,B) local a; a := convert(n, base, B):

%p add(a[i], i=1..nops(a)): end;

%p f:=proc(n,k,B) global digsum; local i;

%p add( digsum(i,B)^k,i=0..n); end;

%p lprint([seq(digsum(n,10),n=0..100)]); # A007953

%p lprint([seq(f(n,1,10),n=0..100)]); #A037123

%p lprint([seq(f(n,2,10),n=0..100)]); #A074784

%p lprint([seq(f(n,3,10),n=0..100)]); #A231688

%p lprint([seq(f(n,4,10),n=0..100)]); #A231689

%t Table[Plus@@Flatten[IntegerDigits[Range[n]]], {n, 0, 200}] (* _Enrique Pérez Herrero_, Oct 12 2015 *)

%t a[0] = 0; a[n_] := a[n - 1] + Plus @@ IntegerDigits@ n; Array[a, 70, 0] (* _Robert G. Wilson v_, Jul 06 2018 *)

%o (PARI) a(n)=n*(n+1)/2-9*sum(k=1,n,sum(i=1,ceil(log(k)/log(10)),floor(k/10^i)))

%o (PARI) a(n)={n++;my(t,i,s);c=n;while(c!=0,i++;c\=10);for(j=1,i,d=(n\10^(i-j))%10;t+=(10^(i-j)*(s*d+binomial(d,2)+d*9*(i-j)/2));s+=d);t} \\ _David A. Corneth_, Aug 16 2013

%o (Perl) for $i (0..100){ @j = split "", $i; for (@j){ $sum += $_; } print "$sum,"; } __END__ # gamo(AT)telecable.es

%o (Magma) [ n eq 0 select 0 else &+[&+Intseq(k): k in [0..n]]: n in [0..56] ]; // _Bruno Berselli_, May 27 2011

%Y Cf. A004207, A016052, A131383, A131384, A131451.

%Y Cf. also A074784, A231688, A231689.

%Y Partial sums of A007953.

%K nonn,base,easy,changed

%O 0,3

%A Vasiliy Danilov (danilovv(AT)usa.net), Jun 15 1998

%E More terms from Antonio G. Astudillo (afg_astudillo(AT)hotmail.com), Sep 07 2002