OFFSET
1,3
LINKS
Amiram Eldar, Table of n, a(n) for n = 1..10000
FORMULA
MATHEMATICA
Table[n^2 (n + 1)/2 - Sum[DivisorSigma[2, k], {k, 1, n}], {n, 1, 55}]
nmax = 55; CoefficientList[Series[x (1 + 2 x)/(1 - x)^4 - 1/(1 - x) Sum[k^2 x^k/(1 - x^k), {k, 1, nmax}], {x, 0, nmax}], x] // Rest
Table[Sum[Mod[n, k] k, {k, 1, n}], {n, 1, 55}]
PROG
(PARI) a(n) = n^2*(n+1)/2 - sum(k=1, n, sigma(k, 2)); \\ Michel Marcus, Sep 18 2021
(Python)
from math import isqrt
def A309176(n): return (n**2*(n+1)>>1)+((s:=isqrt(n))**2*(s+1)*(2*s+1)-sum((q:=n//k)*(6*k**2+q*(2*q+3)+1) for k in range(1, s+1)))//6 # Chai Wah Wu, Oct 21 2023
CROSSREFS
KEYWORD
nonn
AUTHOR
Ilya Gutkovskiy, Jul 15 2019
STATUS
approved