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 A309176 #16 Oct 21 2023 17:06:33 %S A309176 0,0,2,3,12,13,33,40,66,81,135,135,212,249,319,354,489,511,681,725, %T A309176 876,981,1233,1235,1509,1660,1920,2032,2437,2472,2936,3091,3488,3755, %U A309176 4275,4290,4955,5292,5854,6024,6843,6968,7870,8190,8839,9340,10420,10442,11568,12038,13014,13474,14851,15098,16436 %N A309176 a(n) = n^2 * (n + 1)/2 - Sum_{k=1..n} sigma_2(k). %H A309176 Amiram Eldar, <a href="/A309176/b309176.txt">Table of n, a(n) for n = 1..10000</a> %F A309176 G.f.: x * (1 + 2*x)/(1 - x)^4 - (1/(1 - x)) * Sum_{k>=1} k^2 * x^k/(1 - x^k). %F A309176 a(n) = Sum_{k=1..n} (n mod k) * k. %F A309176 a(n) = A002411(n) - A064602(n). %t A309176 Table[n^2 (n + 1)/2 - Sum[DivisorSigma[2, k], {k, 1, n}], {n, 1, 55}] %t A309176 nmax = 55; CoefficientList[Series[x (1 + 2 x)/(1 - x)^4 - 1/(1 - x) Sum[k^2 x^k/(1 - x^k), {k, 1, nmax}], {x, 0, nmax}], x] // Rest %t A309176 Table[Sum[Mod[n, k] k, {k, 1, n}], {n, 1, 55}] %o A309176 (PARI) a(n) = n^2*(n+1)/2 - sum(k=1, n, sigma(k, 2)); \\ _Michel Marcus_, Sep 18 2021 %o A309176 (Python) %o A309176 from math import isqrt %o A309176 def A309176(n): return (n**2*(n+1)>>1)+((s:=isqrt(n))**2*(s+1)*(2*s+1)-sum((q:=n//k)*(6*k**2+q*(2*q+3)+1) for k in range(1,s+1)))//6 # _Chai Wah Wu_, Oct 21 2023 %Y A309176 Cf. A000326, A001157, A004125, A048158, A051126, A154585, A256532. %Y A309176 Cf. A002411, A064602. %K A309176 nonn %O A309176 1,3 %A A309176 _Ilya Gutkovskiy_, Jul 15 2019