%I #33 Oct 29 2023 13:32:41
%S -1,0,-4,1,-5,-1,-9,4,-9,-3,-15,5,-9,-1,-25,4,-14,-1,-21,9,-23,-11,
%T -35,17,-14,0,-40,0,-30,-6,-38,23,-25,-7,-55,10,-28,-8,-64,14,-28,4,
%U -40,20,-58,-34,-82,34,-23,8,-64,6,-48,-8,-80,24,-56,-26,-86,34,-28,4,-100,25,-59
%N a(n) = Sum_{k=1..n} (-1)^k*k*floor(n/k).
%C n - 2*[ n/2 ] + 3*[ n/3 ] - ... + m*n*[ n/n ], where m = (-1)^(n+1).
%H Seiichi Manyama, <a href="/A024919/b024919.txt">Table of n, a(n) for n = 1..10000</a>
%F a(n) = 4*A024916(floor(n/2)) - A024916(n). - _Vladeta Jovovic_, Oct 15 2002
%F G.f.: 1/(1-x) * Sum_{n>=1} n*x^n*(3*x^n-1)/(1-x^(2*n)). - _Vladeta Jovovic_, Oct 15 2002
%F G.f.: -1/(1-x) * Sum_{k>=1} x^k/(1+x^k)^2 = 1/(1-x) * Sum_{k>=1} k * (-x)^k/(1-x^k). - _Seiichi Manyama_, Oct 29 2023
%t f[n_] := Sum[(-1)^i*i*Floor[n/i], {i, 1, n}]; Table[ f[n], {n, 1, 85}]
%o (PARI) a(n) = sum(k=1, n, (-1)^k*k*floor(n/k));
%o (Magma) [&+[(-1)^k*k*(n div k): k in [1..n]]: n in [1..70]]; // _Vincenzo Librandi_, Jul 28 2019
%o (Python)
%o from math import isqrt
%o def A024919(n): return (-(s:=isqrt(m:=n>>1))**2*(s+1) + sum((q:=m//k)*((k<<1)+q+1) for k in range(1,s+1))<<1)+((s:=isqrt(n))**2*(s+1)-sum((q:=n//k)*((k<<1)+q+1) for k in range(1,s+1))>>1) # _Chai Wah Wu_, Oct 22 2023
%Y The zeros are A072663.
%Y Partial sums of A002129.
%Y Cf. A024916, A309124.
%K sign
%O 1,3
%A _Clark Kimberling_
%E Edited by _Robert G. Wilson v_, Aug 17 2002