%I #87 Jul 11 2023 19:30:55
%S 1,5,11,23,33,57,71,103,130,170,192,264,290,346,406,486,520,628,666,
%T 786,870,958,1004,1196,1271,1375,1483,1651,1709,1949,2011,2203,2335,
%U 2471,2611,2935,3009,3161,3317,3637,3719,4055,4141,4405,4675,4859,4953,5433
%N a(n) = Sum_{k=1..n} k*d(k) where d(k) is the number of divisors of k.
%C a(n) is also the sum of all parts of all partitions of all positive integers <= n into equal parts. - _Omar E. Pol_, May 29 2017
%C a(n) is also the sum of the multiples of k, not exceeding n, for k = 1, 2, ..., n. See a formula and an example below. - _Wolfdieter Lang_, Oct 18 2021
%H Enrique PĂ©rez Herrero, <a href="/A143127/b143127.txt">Table of n, a(n) for n = 1..1000</a>
%H Vaclav Kotesovec, <a href="/A143127/a143127.jpg">Graph - The asymptotic ratio (1000000 terms)</a>
%F a(n) = Sum_{k=1..n} A038040(k).
%F a(n) = Sum_{m=1..floor(sqrt(n))} m*(m+floor(n/m))*(floor(n/m)+1-m) - A000330(floor(sqrt(n))) = 2*A083356(n) - A000330(floor(sqrt(n))). - _Max Alekseyev_, Jan 31 2012
%F G.f.: x*f'(x)/(1 - x), where f(x) = Sum_{k>=1} x^k/(1 - x^k). - _Ilya Gutkovskiy_, Apr 13 2017 [Sum_{k>=1} k*x^k/((1-x)*(1-x^k)^2), see A038040. - _Wolfdieter Lang_, Oct 18 2021]
%F a(n) = Sum_{k=1..n} k/2 * floor(n/k) * floor(1 + n/k). - _Daniel Suteu_, May 28 2018
%F a(n) ~ log(n) * n^2 / 2 + (gamma - 1/4)*n^2, where gamma is the Euler-Mascheroni constant A001620. - _Vaclav Kotesovec_, Sep 08 2018
%F From _Daniel Hoying_, May 21 2020: (Start)
%F a(n) = Sum_{i=1..floor(sqrt(n))} i*floor(n/i)*(1+floor(n/i)) - [floor(sqrt(n))*(1+floor(sqrt(n)))/2]^2;
%F = Sum_{i=1..floor(sqrt(n))} i*floor(n/i)*(1+floor(n/i)) -A000537(floor(sqrt(n)).
%F a(n) = A000537(floor(sqrt(n)) ; n=1;
%F = A000537(floor(sqrt(n)) + n*(n+1) - floor(n/2)*(floor(n/2)+1) ; 1<n<6;
%F = A000537(floor(sqrt(n)) + n*(n+1) - floor(n/2)*(floor(n/2)+1) + Sum_{i=floor(sqrt(n))+1..floor(n/2)} i*floor(n/i)*(1+floor(n/i)) ; n>=6. (End)
%F a(n) = Sum_{i=1..n} A018804(i)*floor(n/i). - _Ridouane Oudra_, Mar 15 2021
%F a(n) = Sum_{k=1..n} b(n,k), with b(n, k) = Sum_{j=1..floor(n/k)} j*k = floor(n/k) * floor(n/k) + 1)/2. See the formula by _Daniel Suteu_ above. - _Wolfdieter Lang_, Oct 18 2021
%e a(3) = 11 = (1 + 4 + 6), where n*d(n) = (1, 4, 6, 12, 10, 24, ...).
%e a(4) = 23 = (8 + 7 + 5 + 3), where (8, 7, 5, 3) = row 4 of triangle A110661.
%e a(4) = 23 is the sum of [1 2 3 4|2 4|3|4]] (multiples of k =1..4, not exceeding n). - _Wolfdieter Lang_, Oct 18 2021
%e a(4) = [1] + [2 + 1 + 1] + [3 + 1 + 1 + 1] + [4 + 2 + 2 + 1 + 1 + 1 + 1] = 23. - _Omar E. Pol_, Oct 18 2021
%t Accumulate[DivisorSigma[0, Range[48]] Range[48]] (* _Giovanni Resta_, May 29 2018 *)
%o (Haskell)
%o a143127 n = a143127_list !! (n-1)
%o a143127_list = scanl1 (+) a038040_list
%o -- _Reinhard Zumkeller_, Jan 21 2014
%o (PARI) a(n) = sum(k=1, n, k*numdiv(k)); \\ _Michel Marcus_, May 29 2018
%o (Python)
%o from math import isqrt
%o def A143127(n): return -((k:=isqrt(n))*(k+1)>>1)**2+sum(i*(m:=n//i)*(1+m) for i in range(1,k+1)) # _Chai Wah Wu_, Jul 11 2023
%Y Partial sums of A038040.
%Y Cf. A000005, A083356.
%Y Row sums of triangle A110661.
%Y Row sums of triangle A143310. - _Gary W. Adamson_, Aug 06 2008
%Y Cf. A018804.
%K nonn,easy
%O 1,2
%A _Gary W. Adamson_, Jul 26 2008
%E More terms from _Carl Najafi_, Dec 24 2011
%E Edited by _Max Alekseyev_, Jan 31 2012