login
A366917
a(n) = Sum_{k=1..n} (-1)^k*k^3*floor(n/k).
3
-1, 6, -22, 49, -77, 119, -225, 358, -399, 483, -849, 1139, -1059, 1349, -2179, 2500, -2414, 2885, -3975, 4971, -4661, 4663, -7505, 8819, -6932, 8454, -11986, 12438, -11952, 12744, -17048, 20399, -16897, 17501, -25843, 27904, -22750, 25270, -36274, 37184, -31738
OFFSET
1,2
LINKS
FORMULA
a(n) = 16*A064603(floor(n/2)) - A064603(n).
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