The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A366915 a(n) = Sum_{k=1..n} (-1)^k*k^2*floor(n/k). 4
-1, 2, -8, 11, -15, 15, -35, 48, -43, 35, -87, 103, -67, 83, -177, 162, -128, 145, -217, 277, -223, 143, -387, 443, -208, 302, -518, 432, -410, 370, -592, 771, -449, 421, -879, 850, -520, 566, -1134, 1024, -658, 842, -1008, 1310, -1056, 534, -1676, 1714, -737 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
LINKS
FORMULA
a(n) = 8*A064602(floor(n/2))-A064602(n).
MATHEMATICA
a[n_]:=Sum[ (-1)^k*k^2*Floor[n/k], {k, n}]; Array[a, 49] (* Stefano Spezia, Oct 29 2023 *)
PROG
(Python)
from math import isqrt
def A366915(n): return (-(t:=isqrt(m:=n>>1))**2*(t+1)*((t<<1)+1)+sum((q:=m//k)*(6*k**2+q*((q<<1)+3)+1) for k in range(1, t+1))<<2)//3+((s:=isqrt(n))**2*(s+1)*((s<<1)+1)-sum((q:=n//k)*(6*k**2+q*((q<<1)+3)+1) for k in range(1, s+1)))//6
(PARI) a(n) = sum(k=1, n, (-1)^k*k^2*(n\k)); \\ Michel Marcus, Oct 29 2023
CROSSREFS
Sequence in context: A360649 A297831 A045086 * A064105 A129516 A220269
KEYWORD
sign
AUTHOR
Chai Wah Wu, Oct 28 2023
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 14 11:10 EDT 2024. Contains 372532 sequences. (Running on oeis4.)