OFFSET
1,3
FORMULA
G.f.: 1/(1-x) * Sum_{k>=1} x^k/(1+x^k)^3 = -1/(1-x) * Sum_{k>=1} binomial(k+1,2) * (-x)^k/(1-x^k).
PROG
(PARI) a(n) = sum(k=1, n, (-1)^(k-1)*binomial(k+1, 2)*(n\k));
(Python)
from math import isqrt
def A366937(n): return (((s:=isqrt(m:=n>>1))*(s+1)**2*((s<<2)+5)<<1)-(t:=isqrt(n))*(t+1)**2*(t+2)-sum((((q:=m//w)+1)*(q*((q<<2)+5)+6*w*((w<<1)+1))<<1) for w in range(1, s+1))+sum(((q:=n//w)+1)*(q*(q+2)+3*w*(w+1)) for w in range(1, t+1)))//6 # Chai Wah Wu, Oct 29 2023
CROSSREFS
KEYWORD
sign
AUTHOR
Seiichi Manyama, Oct 29 2023
STATUS
approved