Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #154 Nov 26 2024 17:13:30
%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,0,
%T 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,0,
%U 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_3(x) = Sum_{m =-oo..oo} x^(m^2) (number of integer solutions to k^2 = n).
%C Ramanujan theta functions: f(q) (see A121373), phi(q) (the present sequence), psi(q) (A010054), chi(q) (A000700).
%C Theta series of the one-dimensional lattice Z.
%C Also, essentially the same as the theta series of the one-dimensional lattices A_1, A*_1, D_1, D*_1.
%C Number of ways of writing n as a square.
%C Closely related: theta_4(x) = Sum_{m = -oo..oo} (-x)^(m^2). See A002448.
%C Number 6 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 Tom M. Apostol, Modular Functions and Dirichlet Series in Number Theory, Second edition, Springer, 1990, Exercise 1, p. 91.
%D J. M. Borwein and P. B. Borwein, Pi and the AGM, Wiley, 1987, p. 64.
%D L. Comtet, Advanced Combinatorics, Reidel, 1974, p. 104, [5n].
%D J. H. Conway and N. J. A. Sloane, "Sphere Packings, Lattices and Groups", Springer-Verlag, p. 102.
%D N. J. Fine, Basic Hypergeometric Series and Applications, Amer. Math. Soc., 1988; p. 93, Eq. (34.1); p. 78, Eq. (32.22).
%D G. H. Hardy and E. M. Wright, Theorem 352, p. 282.
%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="/A000122/b000122.txt">Table of n, a(n) for n = 0..10000</a>
%H Steven R. Finch, <a href="https://doi.org/10.1017/9781316997741">Mathematical Constants II</a>, Encyclopedia of Mathematics and Its Applications, Cambridge University Press, Cambridge, 2018.
%H M. D. Hirschhorn and J. A. Sellers, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL17/Sellers/sellers32.html">A Congruence Modulo 3 for Partitions into Distinct Non-Multiples of Four</a>, Article 14.9.6, Journal of Integer Sequences, Vol. 17 (2014).
%H K. Ono, S. Robins and P. T. Wahl, <a href="https://web.archive.org/web/20190712123047/http://www.mathcs.emory.edu/~ono/publications-cv/pdfs/006.pdf">On the representation of integers as sums of triangular numbers</a>, Aequationes mathematicae, August 1995, Volume 50, Issue 1-2, pp 73-94.
%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/RamanujanThetaFunctions.html">Ramanujan Theta Functions</a>
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/JacobiThetaFunctions.html">Jacobi Theta Functions</a>
%F Expansion of eta(q^2)^5 / (eta(q)*eta(q^4))^2 in powers of q.
%F Euler transform of period 4 sequence [2, -3, 2, -1, ...].
%F G.f. A(x) satisfies 0 = f(A(x), A(x^2), A(x^4)) where f(u, v, w) = u^2 - v^2 + 2 * w * (w - u). - _Michael Somos_, Jul 20 2004
%F G.f. A(x) satisfies 0 = f(A(x), A(x^3), A(x^9)) where f(u, v, w) = w^4 - v^4 + w * (u - w)^3. - _Michael Somos_, May 11 2019
%F G.f.: Sum_{m=-oo..oo} x^(m^2);
%F a(0) = 1; for n > 0, a(n) = 0 unless n is a square when a(n) = 2.
%F G.f.: Product_{k>0} (1 - x^(2*k))*(1 + x^(2*k-1))^2.
%F G.f.: s(2)^5/(s(1)^2*s(4)^2), where s(k) := subs(q=q^k, eta(q)), where eta(q) is Dedekind's function, cf. A010815. [Fine]
%F The Jacobi triple product identity states that for |x| < 1, z != 0, Product_{n>0} {(1-x^(2n))(1+x^(2n-1)z)(1+x^(2n-1)/z)} = Sum_{n=-inf..inf} x^(n^2)*z^n. Set z=1 to get theta_3(x).
%F For n > 0, a(n) = 2*(floor(sqrt(n))-floor(sqrt(n-1))). - _Mikael Aaltonen_, Jan 17 2015
%F G.f. is a period 1 Fourier series which satisfies f(-1/(4 t)) = 2^(1/2) (t/i)^(1/2) f(t) where q = exp(2 Pi i t). - _Michael Somos_, May 05 2016
%F a(n) = A000132(n)(mod 4). - _John M. Campbell_, Jul 07 2016
%F a(n) = (2/n)*Sum_{k=1..n} A186690(k)*a(n-k), a(0) = 1. - _Seiichi Manyama_, May 27 2017
%F a(n) = 2 * A010052(n) if n>0. a(3*n + 1) = 2 * A089801(n). a(3*n + 2) = 0. a(4*n) = a(n). a(4*n + 2) = a(4*n + 3) = 0. a(8*n + 1) = 2 * A010054(n). - _Michael Somos_, May 11 2019
%F Dirichlet g.f.: 2*zeta(2s). - _Francois Oger_, Oct 26 2019 [Corrected by _Sean A. Irvine_, Nov 26 2024]
%F G.f. appears to equal exp( 2*Sum_{n >= 0} x^(2*n+1)/((2*n+1)*(1 + x^(2*n+1))) ). - _Peter Bala_, Dec 23 2021
%F From _Peter Bala_, Sep 27 2023: (Start)
%F G.f. A(x) satisfies A(x)*A(-x) = A(-x^2)^2.
%F A(x) = Sum_{n >= 1} x^(n-1)*Product_{k >= n} 1 - (-x)^k.
%F A(x)^2 = 1 + 4*Sum_{n >= 1} (-1)^(n+1)*x^(2*n-1)/(1 - x^(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 A(x) = 1 + 2*Sum_{n >= 1} x^(n*(n+1)/2) * ( Product_{k = 1..n-1} 1 + x^k ) /( Product_{k = 1..n} 1 + x^(2*k) ). See Fine, equation 14.43. (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 + 2*q^64 + 2*q^81 + ...
%p add(x^(m^2),m=-10..10): seq(coeff(%,x,n), n=0..100);
%p # alternative
%p A000122 := proc(n)
%p if n = 0 then
%p 1;
%p elif issqr(n) then
%p 2;
%p else
%p 0 ;
%p end if;
%p end proc:
%p seq(A000122(n),n=0..100) ; # _R. J. Mathar_, Feb 22 2021
%t a[ n_] := SeriesCoefficient[ EllipticTheta[ 3, 0, q], {q, 0, n}]; (* _Michael Somos_, Jul 11 2011 *)
%t CoefficientList[ Sum[ x^(m^2), {m, -(n=10), n} ], x ]
%t SquaresR[1, Range[0, 104]] (* _Robert G. Wilson v_, Jul 16 2014 *)
%t QP = QPochhammer; s = QP[q^2]^5/(QP[q]*QP[q^4])^2 + O[q]^105; CoefficientList[s, q] (* _Jean-François Alcover_, Nov 24 2015 *)
%t (4 QPochhammer[q^2]/QPochhammer[-1,-q]^2 + O[q]^101)[[3]] (* _Vladimir Reshetnikov_, Sep 16 2016 *)
%o (PARI) {a(n) = my(A); if( n<0, 0, A = x * O(x^n); polcoeff( eta(x^2 + A)^5 / (eta(x + A) * eta(x^4 + A))^2, n))}; /* _Michael Somos_, Mar 14 2011 */
%o (PARI) {a(n) = issquare(n) * 2 -(n==0)}; /* _Michael Somos_, Jun 17 1999 */
%o (Magma) Basis( ModularForms( Gamma0(4), 1/2), 100) [1]; /* _Michael Somos_, Jun 10 2014 */
%o (Magma) L := Lattice("A",1); A<q> := ThetaSeries(L, 20); A; /* _Michael Somos_, Nov 13 2014 */
%o (Sage)
%o Q = DiagonalQuadraticForm(ZZ, [1])
%o Q.representation_number_list(105) # _Peter Luschny_, Jun 20 2014
%o (Julia)
%o using Nemo
%o function JacobiTheta3(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 A000122List(len) = JacobiTheta3(len, 1)
%o A000122List(105) |> println # _Peter Luschny_, Mar 12 2018
%o (Python)
%o from sympy.ntheory.primetest import is_square
%o def A000122(n): return is_square(n)<<1 if n else 1 # _Chai Wah Wu_, May 17 2023
%Y 1st column of A286815. - _Seiichi Manyama_, May 27 2017
%Y Row d=1 of A122141.
%Y Cf. A002448 (theta_4). Partial sums give A001650.
%Y Cf. A010052, A010054, A089801.
%Y Cf. A000007, A004015, A004016, A008444, A008445, A008446, A008447, A008448, A008449 (Theta series of lattices A_0, A_3, A_2, A_4, ...).
%K nonn,easy,nice
%O 0,2
%A _N. J. A. Sloane_