login
A350107
a(n) = Sum_{k=1..n} k * floor(n/k)^2.
4
1, 6, 14, 31, 45, 81, 101, 150, 191, 253, 285, 401, 439, 527, 623, 752, 802, 979, 1035, 1233, 1369, 1509, 1577, 1901, 2020, 2186, 2362, 2642, 2728, 3136, 3228, 3549, 3765, 3983, 4215, 4772, 4882, 5126, 5382, 5932, 6054, 6630, 6758, 7202, 7664, 7960, 8100, 8936
OFFSET
1,2
LINKS
FORMULA
a(n) = Sum_{k=1..n} k * Sum_{d|k} (2*d - 1)/d = 2 * A143127(n) - A024916(n).
G.f.: (1/(1 - x)) * Sum_{k>=1} (2*k - 1) * x^k/(1 - x^k)^2.
a(n) = Sum_{k=1..n} 2 * k * tau(k) - sigma(k).
MATHEMATICA
a[n_] := Sum[k * Floor[n/k]^2, {k, 1, n}]; Array[a, 50] (* Amiram Eldar, Dec 14 2021 *)
Accumulate[Table[2*k*DivisorSigma[0, k] - DivisorSigma[1, k], {k, 1, 100}]] (* Vaclav Kotesovec, Dec 16 2021 *)
PROG
(PARI) a(n) = sum(k=1, n, k*(n\k)^2);
(PARI) a(n) = sum(k=1, n, k*sumdiv(k, d, (2*d-1)/d));
(PARI) my(N=66, x='x+O('x^N)); Vec(sum(k=1, N, (2*k-1)*x^k/(1-x^k)^2)/(1-x))
(PARI) a(n) = sum(k=1, n, 2*k*numdiv(k)-sigma(k));
(Python)
from math import isqrt
def A350107(n): return -(s:=isqrt(n))**3*(s+1)+sum((q:=n//k)*((k<<1)*((q<<1)+1)-q-1) for k in range(1, s+1))>>1 # Chai Wah Wu, Oct 24 2023
CROSSREFS
Column 2 of A350106.
Sequence in context: A284246 A210000 A134067 * A024932 A273365 A271996
KEYWORD
nonn
AUTHOR
Seiichi Manyama, Dec 14 2021
STATUS
approved