OFFSET
1,2
LINKS
Amiram Eldar, Table of n, a(n) for n = 1..10000
FORMULA
Multiplicative with a(p^e) = p^e if p = 2; (e+1)*p^e if p == 1 (mod 4); ((1+(-1)^e)/2)*p^e if p == 3 (mod 4).
a(n) = n * A002654(n).
G.f.: Sum_{k>0} k(x^k-x^(3k))/(1+x^(2k))^2 = Sum_{k>0} -(-1)^k(2k-1)x^(2k-1)/(1-x^(2k-1))^2.
G.f.: xd/dx(theta_3(x)^2)/4. - Michael Somos, Nov 07 2005
G.f.: (1/4)* Sum_{u,v} (u*u +v*v)* x^(u*u +v*v). - Michael Somos, Jun 14 2007
Sum_{k=1..n} a(k) ~ c * n^2, where c = Pi/8 = 0.392699... (A019675). - Amiram Eldar, Oct 13 2022
MATHEMATICA
f[p_, e_] := If[Mod[p, 4] == 1, e + 1, (1 + (-1)^e)/2] * p^e; f[2, e_] := 2^e; a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* Amiram Eldar, Oct 13 2022 *)
PROG
(PARI) a(n)=if(n<1, 0, n*sumdiv(n, d, (d%4==1)-(d%4==3)))
(PARI) {a(n)=local(r); if(n<1, 0, r=sqrtint(n); sum(x=-r, r, sum(y=-r, r, if(x^2+y^2==n, (x+y)^2) ))/4 )} \\ Michael Somos, Sep 12 2005
(PARI) {a(n)=if(n<1, 0, n*polcoeff( sum(k=1, sqrtint(n), 2*x^k^2, 1+x*O(x^n))^2, n)/4 )} \\ Michael Somos, Sep 12 2005
CROSSREFS
KEYWORD
nonn,mult
AUTHOR
Michael Somos, Aug 21 2005
STATUS
approved