cp's OEIS Frontend

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.

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).

This page as a plain text file.
%I A024916 #208 Oct 22 2023 00:40:33
%S A024916 1,4,8,15,21,33,41,56,69,87,99,127,141,165,189,220,238,277,297,339,
%T A024916 371,407,431,491,522,564,604,660,690,762,794,857,905,959,1007,1098,
%U A024916 1136,1196,1252,1342,1384,1480,1524,1608,1686,1758,1806,1930,1987,2080,2152
%N 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).
%C A024916 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 A024916 Row sums of triangle A134867. - _Gary W. Adamson_, Nov 14 2007
%C A024916 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 A024916 Equals row sums of triangle A158905. - _Gary W. Adamson_, Mar 29 2009
%C A024916 n is prime if and only if a(n) - a(n-1) - 1 = n. - _Omar E. Pol_, Dec 31 2012
%C A024916 Also the alternating row sums of A236104. - _Omar E. Pol_, Jul 21 2014
%C A024916 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 A024916 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 A024916 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 A024916 From _Omar E. Pol_, Feb 17 2020: (Start)
%C A024916 Convolution of A340793 and A000027.
%C A024916 Convolved with A340793 gives A000385. (End)
%C A024916 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 A024916 Hardy and Wright, "An introduction to the theory of numbers", Oxford University Press, fifth edition, p. 266.
%H A024916 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 A024916 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 A024916 P. L. Patodia (pannalal(AT)usa.net), <a href="/A072692/a072692.txt">PARI program for A072692 and A024916</a>.
%H A024916 Peter Polm, <a href="http://bigintegers.blogspot.com/2014/07/sum-of-all-divisors-of-all-positive.html">C# program for A024916</a>.
%H A024916 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 A024916 From _Benoit Cloitre_, Apr 28 2002: (Start)
%F A024916 a(n) = n^2 - A004125(n).
%F A024916 Asymptotically a(n) = n^2*Pi^2/12 + O(n*log(n)). (End)
%F A024916 G.f.: (1/(1-x))*Sum_{k>=1} x^k/(1-x^k)^2. - _Benoit Cloitre_, Apr 23 2003
%F A024916 a(n) = Sum_{m=1..n} (n - (n mod m)). - _Roger L. Bagula_ and _Gary W. Adamson_, Oct 06 2006
%F A024916 a(n) = n^2*Pi^2/12 + O(n*log(n)^(2/3)) [Walfisz]. - _Charles R Greathouse IV_, Jun 19 2012
%F A024916 a(n) = A000217(n) + A153485(n). - _Omar E. Pol_, Jan 28 2014
%F A024916 a(n) = A000292(n) - A076664(n), n > 0. - _Omar E. Pol_, Feb 11 2014
%F A024916 a(n) = A078471(n) + A271342(n). - _Omar E. Pol_, Apr 08 2016
%F A024916 a(n) = (1/2)*(A222548(n) + A006218(n)). - _Ridouane Oudra_, Aug 03 2019
%F A024916 From _Greg Dresden_, Feb 23 2020: (Start)
%F A024916 a(n) = A092406(n) + 8, n>3.
%F A024916 a(n) = A160664(n) - 1, n>0. (End)
%F A024916 a(2*n) = A326123(n) + A326124(n). - _Vaclav Kotesovec_, Aug 18 2021
%F A024916 a(n) = Sum_{k=1..n} k * A010766(n,k). - _Georg Fischer_, Mar 04 2022
%e A024916 From _Omar E. Pol_, Aug 20 2021: (Start)
%e A024916 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 A024916 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 A024916 Illustration of initial terms:                        _ _ _ _
%e A024916                                         _ _ _        |       |_
%e A024916                             _ _ _      |     |       |         |_
%e A024916                   _ _      |     |_    |     |_ _    |           |
%e A024916           _ _    |   |_    |       |   |         |   |           |
%e A024916     _    |   |   |     |   |       |   |         |   |           |
%e A024916    |_|   |_ _|   |_ _ _|   |_ _ _ _|   |_ _ _ _ _|   |_ _ _ _ _ _|
%e A024916 .
%e A024916     1      4        8          15           21             33         (End)
%p A024916 A024916 := proc(n)
%p A024916     add(numtheory[sigma](k),k=0..n) ;
%p A024916 end proc: # _Zerinvary Lajos_, Jan 11 2009
%p A024916 # second Maple program:
%p A024916 a:= proc(n) option remember; `if`(n=0, 0,
%p A024916       numtheory[sigma](n)+a(n-1))
%p A024916     end:
%p A024916 seq(a(n), n=1..100);  # _Alois P. Heinz_, Sep 12 2019
%t A024916 Table[Plus @@ Flatten[Divisors[Range[n]]], {n, 50}] (* _Alonso del Arte_, Mar 06 2006 *)
%t A024916 Table[Sum[n - Mod[n, m], {m, n}], {n, 50}] (* _Roger L. Bagula_ and _Gary W. Adamson_, Oct 06 2006 *)
%t A024916 a[n_] := Sum[DivisorSigma[1, k], {k, n}]; Table[a[n], {n, 51}] (* _Jean-François Alcover_, Dec 16 2011 *)
%t A024916 Accumulate[DivisorSigma[1,Range[60]]] (* _Harvey P. Dale_, Mar 13 2014 *)
%o A024916 (PARI) A024916(n)=sum(k=1,n,n\k*k) \\ _M. F. Hasler_, Nov 22 2007
%o A024916 (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 A024916 (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 A024916 (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 A024916 (C#) See Polm link.
%o A024916 (Haskell)
%o A024916 a024916 n = sum $ map (\k -> k * div n k) [1..n]
%o A024916 -- _Reinhard Zumkeller_, Apr 20 2015
%o A024916 (Magma) [(&+[DivisorSigma(1, k): k in [1..n]]): n in [1..60]]; // _G. C. Greubel_, Mar 15 2019
%o A024916 (Sage) [sum(sigma(k) for k in (1..n)) for n in (1..60)] # _G. C. Greubel_, Mar 15 2019
%o A024916 (Python)
%o A024916 def A024916(n): return sum(k*(n//k) for k in range(1,n+1)) # _Chai Wah Wu_, Dec 17 2021
%o A024916 (Python)
%o A024916 from math import isqrt
%o A024916 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 A024916 Partial sums of A000203.
%Y A024916 Cf. A056550, A104471(2*n-1, n), A123229, A128489, A000217, A134867, A072692, A158905, A237593, A245092, A006218, A222548, A092406, A160664.
%Y A024916 Cf. A000385, A010766, A340793.
%K A024916 nonn,nice
%O A024916 1,2
%A A024916 _Clark Kimberling_