%I #73 Sep 28 2023 12:08:08
%S 1,-2,0,0,2,0,0,0,0,-2,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,-2,0,0,0,0,0,0,0,
%T 0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,-2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,
%U 0,0,0,0,0,0,0,0,0,0,0,0,0,0,-2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0
%N Expansion of Jacobi theta function theta_4(x).
%C Ramanujan theta functions: f(q) (see A121373), phi(q) (A000122), psi(q) (A010054), chi(q) (A000700).
%C Number 2 of the 14 primitive eta-products which are holomorphic modular forms of weight 1/2 listed by D. Zagier on page 30 of "The 1-2-3 of Modular Forms". - _Michael Somos_, May 04 2016
%D N. J. Fine, Basic Hypergeometric Series and Applications, Amer. Math. Soc., 1988; p. 93, Eq. (34.11), p. 6, Eq. (7.324).
%D J. Tannery and J. Molk, Eléments de la Théorie des Fonctions Elliptiques, Vol. 2, Gauthier-Villars, Paris, 1902; Chelsea, NY, 1972, see p. 27.
%D E. T. Whittaker and G. N. Watson, A Course of Modern Analysis, Cambridge Univ. Press, 4th ed., 1963, p. 464.
%H T. D. Noe, <a href="/A002448/b002448.txt">Table of n, a(n) for n = 0..10000</a>
%H J. H. Conway and N. J. A. Sloane, <a href="http://dx.doi.org/10.1007/978-1-4757-2016-7">Sphere Packings, Lattices and Groups</a>, Springer-Verlag, p. 103.
%H J. W. L. Glaisher, <a href="http://resolver.sub.uni-goettingen.de/purl?PPN599484047_0002">On the deduction of series from infinite products</a>, Messenger of Math., 2 (1873), p. 141.
%H Michael Somos, <a href="/A010815/a010815.txt">Introduction to Ramanujan theta functions</a>
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/JacobiThetaFunctions.html">Jacobi Theta Functions</a>
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/q-SeriesIdentities.html">q-Series Identities</a>
%H D. Zagier, <a href="http://dx.doi.org/10.1007/978-3-540-74119-0">Elliptic modular forms and their applications</a> in "The 1-2-3 of modular forms", Springer-Verlag, 2008
%F Expansion of phi(-q) in powers of q where phi() is a Ramanujan theta function.
%F Expansion of eta(q)^2 / eta(q^2) in powers of q. - _Michael Somos_, May 01 2003
%F Expansion of 2 * sqrt( k' * K / (2 Pi) ) in powers of q. - _Michael Somos_, Nov 30 2013
%F Euler transform of period 2 sequence [ -2, -1, ...]. - _Michael Somos_, May 01 2003
%F G.f.: Sum_{k in Z} (-1)^k * x^(k^2) = Product_{k>0} (1 - x^k) / (1 + x^k). - _Michael Somos_, May 01 2003.
%F G.f.: 1 - 2 Sum_{k>0} x^k/(1 - x^k) Product_{j=1..k} (1 - x^j) / (1 + x^j). - _Michael Somos_, Apr 12 2012
%F a(n) = -2 * b(n) where b(n) is multiplicative and b(2^e) = (-1)^(e/2) if e even, b(p^e) = 1 if p>2 and e even, otherwise 0. - _Michael Somos_, Jul 07 2006
%F a(3*n + 1) = -2 * A089802(n), a(9*n) = a(n). - _Michael Somos_, Jul 07 2006
%F a(3*n + 2) = a(4*n + 2) = a(4*n + 3) = 0. a(4*n) = A000122(n). a(n) = (-1)^n * A000122(n). a(8*n + 1) = -2 * A010054(n). - _Michael Somos_, Apr 12 2012
%F For n > 0, a(n) = 2*(floor(sqrt(n))-floor(sqrt(n-1)))*(-1)^(floor(sqrt(n)). - _Mikael Aaltonen_, Jan 17 2015
%F G.f. is a period 1 Fourier series which satisfies f(-1 / (16 t)) = 32^(1/2) (t/i)^(1/2) g(t) where q = exp(2 Pi i t) and g() is the g.f. for A010054. - _Michael Somos_, May 05 2016
%F a(0) = 1, a(n) = -(2/n)*Sum_{k=1..n} A002131(k)*a(n-k) for n > 0. - _Seiichi Manyama_, Apr 29 2017
%F G.f.: exp(Sum_{k>=1} (sigma(k) - sigma(2*k))*x^k/k). - _Ilya Gutkovskiy_, Sep 19 2018
%F From _Peter Bala_, Feb 19 2021: (Start)
%F G.f: A(q) = eta(q^2)^5 / ( eta(-q)*eta(q^4) )^2.
%F A(q) = 1 + 2*Sum_{n >= 1} (-1)^n*q^(n*(n+1)/2)/( (1 + q^n) * Product_{k = 1..n} 1 - q^k ).
%F A(-q)^2 = 1 + 4*Sum_{n >= 1} (-1)^(n+1)*q^(2*n-1)/(1 - q^(2*n-1)), which gives the number of representations of an integer as a sum of two squares. See, for example, Fine, 26.63.
%F The unsigned sequence has the g.f. 1 + 2*Sum_{n >= 1} q^(n*(n+1)/2) * ( Product_{k = 1..n-1} 1 + q^k ) /( Product_{k = 1..n} 1 + q^(2*k) ) = 1 + 2*q + 2*q^4 + 2*q^9 + .... See Fine, equation 14.43. (End)
%F Form _Peter Bala_, Sep 27 2023: (Start)
%F G.f. A(q) satisfies A(q)*A(-q) = A(q^2)^2.
%F A(q) = Sum_{n >= 1} (-q)^(n-1)*Product_{k >= n} 1 - q^k. (End)
%e G.f. = 1 - 2*q + 2*q^4 - 2*q^9 + 2*q^16 - 2*q^25 + 2*q^36 - 2*q^49 + ...
%p Sum((-x)^(m^2),m=-10..10);
%t a[ n_] := SeriesCoefficient[ EllipticTheta[ 4, 0, q], {q, 0, n}]; (* _Michael Somos_, Jul 11 2011 *)
%t QP = QPochhammer; s = QP[q]^2/QP[q^2] + O[q]^105; CoefficientList[s, q] (* _Jean-François Alcover_, Dec 01 2015, adapted from PARI *)
%o (PARI) {a(n) = if( n<0, 0, (-1)^n * issquare(n) * 2 - (n==0))}; /* _Michael Somos_, Jun 17 1999 */
%o (PARI) {a(n) = my(A); if( n<0, 0, A = x * O(x^n); polcoeff( eta(x + A)^2 / eta(x^2 + A), n))}; /* _Michael Somos_, May 01 2003 */
%o (Julia)
%o using Nemo
%o function JacobiTheta4(len, r)
%o R, x = PolynomialRing(ZZ, "x")
%o e = theta_qexp(r, len, -x)
%o [fmpz(coeff(e, j)) for j in 0:len - 1] end
%o A002448List(len) = JacobiTheta4(len, 1)
%o A002448List(105) |> println # _Peter Luschny_, Mar 12 2018
%o (Python)
%o from sympy.ntheory.primetest import is_square
%o def A002448(n): return (-is_square(n) if n&1 else is_square(n))<<1 if n else 1 # _Chai Wah Wu_, May 17 2023
%Y Cf. A000122, A000203, A010054, A089802.
%K sign,easy
%O 0,2
%A _N. J. A. Sloane_