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 A333505 #61 Oct 30 2023 10:57:11 %S A333505 1,0,2,2,2,2,5,5,1,4,9,9,2,2,9,17,5,5,11,11,2,12,23,23,-4,1,14,26,15, %T A333505 15,22,22,-6,8,25,37,9,9,28,44,7,7,18,18,3,35,58,58,-9,-2,18,38,21,21, %U A333505 36,52,5,27,56,56,-3,-3,28,68,8,26,45,45,24,50,73,73,-23,-23,14 %N A333505 a(n) = Sum_{k=1..n} (-1)^(k+1) * k * ceiling(n/k). %F A333505 G.f.: (x/(1 - x)) * (1/(1 + x)^2 + Sum_{k>=1} (-1)^(k+1) * k * x^k / (1 - x^k)). %F A333505 a(n) = (-1)^(n+1) * ceiling(n/2) + Sum_{k=1..n-1} A002129(k). %F A333505 a(n) = A001057(n) - A024919(n-1). %t A333505 Table[Sum[(-1)^(k + 1) k Ceiling[n/k], {k, 1, n}], {n, 1, 75}] %t A333505 Table[(-1)^(n + 1) Ceiling[n/2] + Sum[DivisorSum[k, (-1)^(# + 1) # &], {k, 1, n - 1}], {n, 1, 75}] %t A333505 nmax = 75; CoefficientList[Series[x/(1 - x) (1/(1 + x)^2 + Sum[(-1)^(k + 1) k x^k/(1 - x^k), {k, 1, nmax}]), {x, 0, nmax}], x] // Rest %o A333505 (PARI) a(n) = sum(k=1, n, (-1)^(k+1)*k*ceil(n/k)); \\ _Michel Marcus_, May 26 2020 %o A333505 (Python) %o A333505 from math import isqrt %o A333505 def A333505(n): return ((s:=isqrt(m:=n-1>>1))**2*(s+1)-sum((q:=m//k)*((k<<1)+q+1) for k in range(1,s+1))<<1)-((t:=isqrt(n-1))**2*(t+1)-sum((q:=(n-1)//k)*((k<<1)+q+1) for k in range(1,t+1))>>1) + (m+1 if n&1 else -m-1) # _Chai Wah Wu_, Oct 30 2023 %Y A333505 Cf. A001057, A002129, A006590, A024916, A024919, A332490, A332682. %K A333505 sign %O A333505 1,3 %A A333505 _Ilya Gutkovskiy_, May 25 2020