The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
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!)
A024916 a(n) = Sum_{k=1..n} k*floor(n/k); also Sum_{k=1..n} sigma(k) where sigma(n) = sum of divisors of n (A000203). 221

%I #208 Oct 22 2023 00:40:33

%S 1,4,8,15,21,33,41,56,69,87,99,127,141,165,189,220,238,277,297,339,

%T 371,407,431,491,522,564,604,660,690,762,794,857,905,959,1007,1098,

%U 1136,1196,1252,1342,1384,1480,1524,1608,1686,1758,1806,1930,1987,2080,2152

%N a(n) = Sum_{k=1..n} k*floor(n/k); also Sum_{k=1..n} sigma(k) where sigma(n) = sum of divisors of n (A000203).

%C Row sums of triangle A128489. E.g., a(5) = 15 = (10 + 3 + 1 + 1), sum of row 4 terms of triangle A128489. - _Gary W. Adamson_, Jun 03 2007

%C Row sums of triangle A134867. - _Gary W. Adamson_, Nov 14 2007

%C a(10^4) = 82256014, a(10^5) = 8224740835, a(10^6) = 822468118437, a(10^7) = 82246711794796; see A072692. - _M. F. Hasler_, Nov 22 2007

%C Equals row sums of triangle A158905. - _Gary W. Adamson_, Mar 29 2009

%C n is prime if and only if a(n) - a(n-1) - 1 = n. - _Omar E. Pol_, Dec 31 2012

%C Also the alternating row sums of A236104. - _Omar E. Pol_, Jul 21 2014

%C a(n) is also the total number of parts in all partitions of the positive integers <= n into equal parts. - _Omar E. Pol_, Apr 30 2017

%C a(n) is also the total area of the terraces of the stepped pyramid with n levels described in A245092. - _Omar E. Pol_, Nov 04 2017

%C a(n) is also the area under the Dyck path described in the n-th row of A237593 (see example). - _Omar E. Pol_, Sep 17 2018

%C From _Omar E. Pol_, Feb 17 2020: (Start)

%C Convolution of A340793 and A000027.

%C Convolved with A340793 gives A000385. (End)

%C a(n) is also the number of cubic cells (or cubes) in the n-th level starting from the top of the stepped pyramid described in A245092. - _Omar E. Pol_, Jan 12 2022

%D Hardy and Wright, "An introduction to the theory of numbers", Oxford University Press, fifth edition, p. 266.

%H Daniel Mondot, <a href="/A024916/b024916.txt">Table of n, a(n) for n = 1..10000</a> (first 1000 terms from T. D. Noe)

%H Vaclav Kotesovec, <a href="/A024916/a024916_1.jpg">Plot of (a(n) - Pi^2*n^2/12) / (n*log(n)^(2/3)) for n = 2..100000</a>.

%H P. L. Patodia (pannalal(AT)usa.net), <a href="/A072692/a072692.txt">PARI program for A072692 and A024916</a>.

%H Peter Polm, <a href="http://bigintegers.blogspot.com/2014/07/sum-of-all-divisors-of-all-positive.html">C# program for A024916</a>.

%H A. Walfisz, <a href="http://dx.doi.org/10.1002/zamm.19640441217">Weylsche Exponentialsummen in der neueren Zahlentheorie</a>, ZAMM - Journal of Applied Mathematics and Mechanics / Zeitschrift für Angewandte Mathematik und Mechanik, Volume 44, Issue 12, page 607, 1964.

%F From _Benoit Cloitre_, Apr 28 2002: (Start)

%F a(n) = n^2 - A004125(n).

%F Asymptotically a(n) = n^2*Pi^2/12 + O(n*log(n)). (End)

%F G.f.: (1/(1-x))*Sum_{k>=1} x^k/(1-x^k)^2. - _Benoit Cloitre_, Apr 23 2003

%F a(n) = Sum_{m=1..n} (n - (n mod m)). - _Roger L. Bagula_ and _Gary W. Adamson_, Oct 06 2006

%F a(n) = n^2*Pi^2/12 + O(n*log(n)^(2/3)) [Walfisz]. - _Charles R Greathouse IV_, Jun 19 2012

%F a(n) = A000217(n) + A153485(n). - _Omar E. Pol_, Jan 28 2014

%F a(n) = A000292(n) - A076664(n), n > 0. - _Omar E. Pol_, Feb 11 2014

%F a(n) = A078471(n) + A271342(n). - _Omar E. Pol_, Apr 08 2016

%F a(n) = (1/2)*(A222548(n) + A006218(n)). - _Ridouane Oudra_, Aug 03 2019

%F From _Greg Dresden_, Feb 23 2020: (Start)

%F a(n) = A092406(n) + 8, n>3.

%F a(n) = A160664(n) - 1, n>0. (End)

%F a(2*n) = A326123(n) + A326124(n). - _Vaclav Kotesovec_, Aug 18 2021

%F a(n) = Sum_{k=1..n} k * A010766(n,k). - _Georg Fischer_, Mar 04 2022

%e From _Omar E. Pol_, Aug 20 2021: (Start)

%e For n = 6 the sum of all divisors of the first six positive integers is [1] + [1 + 2] + [1 + 3] + [1 + 2 + 4] + [1 + 5] + [1 + 2 + 3 + 6] = 1 + 3 + 4 + 7 + 6 + 12 = 33, so a(6) = 33.

%e On the other hand the area under the Dyck path of the 6th diagram as shown below is equal to 33, so a(6) = 33.

%e Illustration of initial terms: _ _ _ _

%e _ _ _ | |_

%e _ _ _ | | | |_

%e _ _ | |_ | |_ _ | |

%e _ _ | |_ | | | | | |

%e _ | | | | | | | | | |

%e |_| |_ _| |_ _ _| |_ _ _ _| |_ _ _ _ _| |_ _ _ _ _ _|

%e .

%e 1 4 8 15 21 33 (End)

%p A024916 := proc(n)

%p add(numtheory[sigma](k),k=0..n) ;

%p end proc: # _Zerinvary Lajos_, Jan 11 2009

%p # second Maple program:

%p a:= proc(n) option remember; `if`(n=0, 0,

%p numtheory[sigma](n)+a(n-1))

%p end:

%p seq(a(n), n=1..100); # _Alois P. Heinz_, Sep 12 2019

%t Table[Plus @@ Flatten[Divisors[Range[n]]], {n, 50}] (* _Alonso del Arte_, Mar 06 2006 *)

%t Table[Sum[n - Mod[n, m], {m, n}], {n, 50}] (* _Roger L. Bagula_ and _Gary W. Adamson_, Oct 06 2006 *)

%t a[n_] := Sum[DivisorSigma[1, k], {k, n}]; Table[a[n], {n, 51}] (* _Jean-François Alcover_, Dec 16 2011 *)

%t Accumulate[DivisorSigma[1,Range[60]]] (* _Harvey P. Dale_, Mar 13 2014 *)

%o (PARI) A024916(n)=sum(k=1,n,n\k*k) \\ _M. F. Hasler_, Nov 22 2007

%o (PARI) A024916(z) = { my(s,u,d,n,a,p); s = z*z; u = sqrtint(z); p = 2; for(d=1, u, n = z\d - z\(d+1); if(n<=1, p=d; break(), a = z%d; s -= (2*a+(n-1)*d)*n/2); ); u = z\p; for(d=2, u, s -= z%d); return(s); } \\ See the link for a nicely formatted version. - P. L. Patodia (pannalal(AT)usa.net), Jan 11 2008

%o (PARI) A024916(n)={my(s=0,d=1,q=n);while(d<q,s+=q*(q+1+2*d)\2;d++;q=n\d;);return(s-d*(d-1)\2*d+q*(q+1)\2);} \\ _Peter Polm_, Aug 18 2014

%o (PARI) A024916(n)={ my(s=n^2, r=sqrtint(n), nd=n, D); for(d=1, r, (1>=D=nd-nd=n\(d+1)) && (r=d-1) && break; s -= n%d*D+(D-1)*D\2*d); s - sum(d=2, n\(r+1), n%d)} \\ Slightly optimized version of Patodia's code. - _M. F. Hasler_, Apr 18 2015

%o (C#) See Polm link.

%o (Haskell)

%o a024916 n = sum $ map (\k -> k * div n k) [1..n]

%o -- _Reinhard Zumkeller_, Apr 20 2015

%o (Magma) [(&+[DivisorSigma(1, k): k in [1..n]]): n in [1..60]]; // _G. C. Greubel_, Mar 15 2019

%o (Sage) [sum(sigma(k) for k in (1..n)) for n in (1..60)] # _G. C. Greubel_, Mar 15 2019

%o (Python)

%o def A024916(n): return sum(k*(n//k) for k in range(1,n+1)) # _Chai Wah Wu_, Dec 17 2021

%o (Python)

%o from math import isqrt

%o def A024916(n): return (-(s:=isqrt(n))**2*(s+1) + sum((q:=n//k)*((k<<1)+q+1) for k in range(1,s+1)))>>1 # _Chai Wah Wu_, Oct 21 2023

%Y Partial sums of A000203.

%Y Cf. A056550, A104471(2*n-1, n), A123229, A128489, A000217, A134867, A072692, A158905, A237593, A245092, A006218, A222548, A092406, A160664.

%Y Cf. A000385, A010766, A340793.

%K nonn,nice

%O 1,2

%A _Clark Kimberling_

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 May 13 09:49 EDT 2024. Contains 372504 sequences. (Running on oeis4.)