This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A024919 #33 Oct 29 2023 13:32:41 %S A024919 -1,0,-4,1,-5,-1,-9,4,-9,-3,-15,5,-9,-1,-25,4,-14,-1,-21,9,-23,-11, %T A024919 -35,17,-14,0,-40,0,-30,-6,-38,23,-25,-7,-55,10,-28,-8,-64,14,-28,4, %U A024919 -40,20,-58,-34,-82,34,-23,8,-64,6,-48,-8,-80,24,-56,-26,-86,34,-28,4,-100,25,-59 %N A024919 a(n) = Sum_{k=1..n} (-1)^k*k*floor(n/k). %C A024919 n - 2*[ n/2 ] + 3*[ n/3 ] - ... + m*n*[ n/n ], where m = (-1)^(n+1). %H A024919 Seiichi Manyama, <a href="/A024919/b024919.txt">Table of n, a(n) for n = 1..10000</a> %F A024919 a(n) = 4*A024916(floor(n/2)) - A024916(n). - _Vladeta Jovovic_, Oct 15 2002 %F A024919 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 A024919 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 A024919 f[n_] := Sum[(-1)^i*i*Floor[n/i], {i, 1, n}]; Table[ f[n], {n, 1, 85}] %o A024919 (PARI) a(n) = sum(k=1, n, (-1)^k*k*floor(n/k)); %o A024919 (Magma) [&+[(-1)^k*k*(n div k): k in [1..n]]: n in [1..70]]; // _Vincenzo Librandi_, Jul 28 2019 %o A024919 (Python) %o A024919 from math import isqrt %o A024919 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 A024919 The zeros are A072663. %Y A024919 Partial sums of A002129. %Y A024919 Cf. A024916, A309124. %K A024919 sign %O A024919 1,3 %A A024919 _Clark Kimberling_ %E A024919 Edited by _Robert G. Wilson v_, Aug 17 2002