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 A309081 #19 Sep 08 2022 08:46:21 %S A309081 1,2,3,3,4,5,6,6,8,9,10,10,11,12,13,12,13,15,16,16,17,18,19,19,21,22, %T A309081 24,24,25,26,27,26,27,28,29,29,30,31,32,32,33,34,35,35,37,38,39,38,40, %U A309081 42,43,43,44,46,47,47,48,49,50,50,51,52,54,52,53,54,55,55,56,57,58,58,59,60,62 %N A309081 a(n) = n - floor(n/2^2) + floor(n/3^2) - floor(n/4^2) + ... %H A309081 Robert Israel, <a href="/A309081/b309081.txt">Table of n, a(n) for n = 1..10000</a> %F A309081 G.f.: (1/(1 - x)) * Sum_{k>=1} (-1)^(k+1) * x^(k^2)/(1 - x^(k^2)). %F A309081 a(n) ~ Pi^2*n/12. - _Vaclav Kotesovec_, Oct 12 2019 %p A309081 N:= 100: # for a(1)..a(N) %p A309081 V:= Vector([$1..N]): %p A309081 for k from 2 to floor(sqrt(N)) do %p A309081 for j from 1 to N/k^2 do %p A309081 t:=min((j+1)*k^2-1,N); %p A309081 V[j*k^2..t]:= V[j*k^2..t] +~ (-1)^(k+1)*j %p A309081 od od: %p A309081 convert(V,list); # _Robert Israel_, Jul 12 2019 %t A309081 Table[Sum[(-1)^(k + 1) Floor[n/k^2], {k, 1, n}], {n, 1, 75}] %t A309081 nmax = 75; CoefficientList[Series[1/(1 - x) Sum[(-1)^(k + 1) x^(k^2)/(1 - x^(k^2)), {k, 1, Floor[nmax^(1/2)] + 1}], {x, 0, nmax}], x] // Rest %t A309081 Table[Sum[Boole[IntegerQ[d^(1/2)] && OddQ[d]], {d, Divisors[n]}] - Sum[Boole[IntegerQ[d^(1/2)] && EvenQ[d]], {d, Divisors[n]}], {n, 1, 75}] // Accumulate %o A309081 (Magma) [1] cat [m-&+[(-1)^(k)*Floor(m/k^2):k in [2..m] ]:m in [2..75]]; // _Marius A. Burtea_, Jul 12 2019 %o A309081 (Python) %o A309081 from math import isqrt %o A309081 def A309081(n): return n+sum((1 if k%2 else -1)*(n//k**2) for k in range(2,isqrt(n)+1)) # _Chai Wah Wu_, Dec 20 2021 %Y A309081 Cf. A013936, A046951, A059851, A309082, A309083. %K A309081 nonn %O A309081 1,2 %A A309081 _Ilya Gutkovskiy_, Jul 11 2019