OFFSET
1,2
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
MAPLE
f:= proc(n) local k; add((-1)^k * k^3 * floor(n/k), k=1..n) end proc;
map(f, [$1..100]); # Robert Israel, Dec 29 2023
MATHEMATICA
a[n_]:=Sum[ (-1)^k*k^3*Floor[n/k], {k, n}]; Array[a, 41] (* Stefano Spezia, Oct 29 2023 *)
PROG
(Python)
from math import isqrt
def A366917(n): return (-(t:=isqrt(m:=n>>1))**3*(t+1)**2+sum((q:=m//k)*((k**3<<2)+q*(q*(q+2)+1)) for k in range(1, t+1))<<2)+((s:=isqrt(n))**3*(s+1)**2 - sum((q:=n//k)*((k**3<<2)+q*(q*(q+2)+1)) for k in range(1, s+1))>>2)
(PARI) a(n) = sum(k=1, n, (-1)^k*k^3*(n\k)); \\ Michel Marcus, Oct 29 2023
CROSSREFS
KEYWORD
sign,look
AUTHOR
Chai Wah Wu, Oct 28 2023
STATUS
approved