login
One-half of theta series of square lattice (or half the number of ways of writing n > 0 as a sum of 2 squares), without the constant term, which is 1/2.
5

%I #21 Dec 11 2017 02:40:00

%S 2,2,0,2,4,0,0,2,2,4,0,0,4,0,0,2,4,2,0,4,0,0,0,0,6,4,0,0,4,0,0,2,0,4,

%T 0,2,4,0,0,4,4,0,0,0,4,0,0,0,2,6,0,4,4,0,0,0,0,4,0,0,4,0,0,2,8,0,0,4,

%U 0,0,0,2,4,4,0,0,0,0,0,4,2,4,0,0,8,0,0,0,4,4,0,0,0,0,0,0,4,2,0

%N One-half of theta series of square lattice (or half the number of ways of writing n > 0 as a sum of 2 squares), without the constant term, which is 1/2.

%C This is the Jacobi elliptic function K(q)/Pi - 1/2 [see Fine].

%D N. J. Fine, Basic Hypergeometric Series and Applications, Amer. Math. Soc., 1988; Eq. (34.4).

%H G. C. Greubel, <a href="/A105673/b105673.txt">Table of n, a(n) for n = 1..10000</a>

%F G.f. A(x) satisfies 0 = f(A(x), A(x^2), A(x^4)) where f(u, v, w) = (u-v)^2 - (v-w) * (4*w + 2). - _Michael Somos_, May 13 2005

%F a(n) = 2 * A002654(n). - _Michael Somos_, Jan 25 2017

%e G.f. = 2*q + 2*q^2 + 2*q^4 + 4*q^5 + 2*q^8 + 2*q^9 + 4*q^10 + 4*q^13 + 2*q^16 + ...

%t CoefficientList[Series[(EllipticTheta[3, 0, x]^2 - 1)/(2 x), {x, 0, 100}], x] (* _Jan Mangaldan_, Jan 04 2017 *)

%t a[ n_] := If[ n < 1, 0, SquaresR[ 2, n] / 2]; (* _Michael Somos_, Jan 25 2017 *)

%t a[ n_] := If[ n < 1, 0, 2 DivisorSum[ n, KroneckerSymbol[ -4, #] &]]; (* _Michael Somos_, Jan 25 2017 *)

%t a[ n_] := SeriesCoefficient[ (EllipticTheta[ 3, 0, q]^2 - 1) / 2, {q, 0, n}]; (* _Michael Somos_, Jan 25 2017 *)

%o (PARI) qfrep([1, 0; 0, 1], 100)

%o (PARI) {a(n) = if( n<1, 0, qfrep([1, 0; 0, 1], n)[n])}; /* _Michael Somos_, May 13 2005 */

%o (PARI) {a(n) = if( n<1, 0, 2 * sumdiv( n, d, (d%4==1) - (d%4==3)))}; /* _Michael Somos_, Jan 25 2017 */

%Y (Theta_3)^2 is given in A004018.

%Y Equals A004018(n)/2 for n > 0.

%K nonn

%O 1,1

%A _N. J. A. Sloane_, May 05 2005