OFFSET
1,2
FORMULA
G.f.: x/(1 - x)^3 + (x/(1 - x)) * Sum_{k>=1} x^k / (1 - x^k)^2.
a(n) = n*(n + 1)/2 + Sum_{k=1..n-1} sigma(k).
a(n) ~ (6 + Pi^2)*n^2/12. - Vaclav Kotesovec, Mar 10 2020
MATHEMATICA
Table[Sum[k Ceiling[n/k], {k, 1, n}], {n, 1, 50}]
Table[n (n + 1)/2 + Sum[DivisorSigma[1, k], {k, 1, n - 1}], {n, 1, 50}]
nmax = 50; CoefficientList[Series[x/(1 - x)^3 + (x/(1 - x)) Sum[x^k/(1 - x^k)^2, {k, 1, nmax}], {x, 0, nmax}], x] // Rest
PROG
(Magma) [&+[k*Ceiling(n/k):k in [1..n]]:n in [1..50]]; // Marius A. Burtea, Feb 16 2020
(PARI) a(n) = sum(k=1, n, k*ceil(n/k)); \\ Michel Marcus, Feb 17 2020
(Python)
from math import isqrt
def A332490(n): return n*(n+1)-(s:=isqrt(n-1))**2*(s+1)+sum((q:=(n-1)//k)*((k<<1)+q+1) for k in range(1, s+1))>>1 # Chai Wah Wu, Oct 22 2023
CROSSREFS
KEYWORD
nonn
AUTHOR
Ilya Gutkovskiy, Feb 16 2020
STATUS
approved