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

%I #9 Oct 29 2023 22:05:39

%S -1,2,-8,11,-15,15,-35,48,-43,35,-87,103,-67,83,-177,162,-128,145,

%T -217,277,-223,143,-387,443,-208,302,-518,432,-410,370,-592,771,-449,

%U 421,-879,850,-520,566,-1134,1024,-658,842,-1008,1310,-1056,534,-1676,1714,-737

%N a(n) = Sum_{k=1..n} (-1)^k*k^2*floor(n/k).

%F a(n) = 8*A064602(floor(n/2))-A064602(n).

%t a[n_]:=Sum[ (-1)^k*k^2*Floor[n/k],{k,n}]; Array[a,49] (* _Stefano Spezia_, Oct 29 2023 *)

%o (Python)

%o from math import isqrt

%o 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

%o (PARI) a(n) = sum(k=1, n, (-1)^k*k^2*(n\k)); \\ _Michel Marcus_, Oct 29 2023

%Y Cf. A024919, A064602.

%K sign

%O 1,2

%A _Chai Wah Wu_, Oct 28 2023

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 June 8 21:00 EDT 2024. Contains 373227 sequences. (Running on oeis4.)