login
A024920
a(n) = Sum_{k=1..n} (n-k) * floor(n/k).
1
0, 2, 7, 17, 29, 51, 71, 104, 138, 183, 220, 293, 340, 409, 486, 580, 646, 767, 843, 981, 1099, 1221, 1317, 1525, 1653, 1802, 1961, 2168, 2297, 2568, 2709, 2951, 3154, 3359, 3578, 3942, 4118, 4352, 4598, 4978, 5176, 5576, 5786, 6136, 6504, 6798, 7030, 7574, 7862, 8270, 8609
OFFSET
1,2
LINKS
FORMULA
From Vaclav Kotesovec, May 28 2021: (Start)
a(n) = n*A006218(n) - A024916(n).
a(n) ~ n^2 * (log(n) + 2*gamma - 1 - Pi^2/12), where gamma is the Euler-Mascheroni constant A001620. (End)
MAPLE
A024920:=n->add((n-k)*floor(n/k), k=1..n): seq(A024920(n), n=1..80); # Wesley Ivan Hurt, Apr 02 2017
MATHEMATICA
Table[Sum [(n - k) Floor[n/k], {k, n}], {n, 51}] (* Michael De Vlieger, Apr 03 2017 *)
Table[Sum[n*DivisorSigma[0, k] - DivisorSigma[1, k], {k, 1, n}], {n, 1, 50}] (* Vaclav Kotesovec, May 28 2021 *)
PROG
(PARI) a(n) = sum(k=1, n, (n-k)*floor(n/k)) \\ Michel Marcus, Mar 23 2013
(Python)
from math import isqrt
def A024920(n): return (s:=isqrt(n))**2*(s+1-(n<<1))+sum((q:=n//k)*((n<<2)-(k<<1)-q-1) for k in range(1, s+1))>>1 # Chai Wah Wu, Oct 23 2023
CROSSREFS
Sequence in context: A260801 A031377 A019357 * A091313 A049554 A019398
KEYWORD
nonn
STATUS
approved