cp's OEIS Frontend

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.

A000122 Expansion of Jacobi theta function theta_3(x) = Sum_{m =-oo..oo} x^(m^2) (number of integer solutions to k^2 = n).

This page as a plain text file.
%I A000122 #161 Aug 18 2025 22:15:12
%S A000122 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 A000122 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 A000122 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 A000122 Expansion of Jacobi theta function theta_3(x) = Sum_{m =-oo..oo} x^(m^2) (number of integer solutions to k^2 = n).
%C A000122 Ramanujan theta functions: f(q) (see A121373), phi(q) (the present sequence), psi(q) (A010054), chi(q) (A000700).
%C A000122 Theta series of the one-dimensional lattice Z.
%C A000122 Also, essentially the same as the theta series of the one-dimensional lattices A_1, A*_1, D_1, D*_1.
%C A000122 Number of ways of writing n as a square.
%C A000122 Closely related: theta_4(x) = Sum_{m = -oo..oo} (-x)^(m^2). See A002448.
%C A000122 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 A000122 Tom M. Apostol, Modular Functions and Dirichlet Series in Number Theory, Second edition, Springer, 1990, Exercise 1, p. 91.
%D A000122 Richard Bellman, A Brief Introduction to Theta Functions, Dover, 2013.
%D A000122 J. M. Borwein and P. B. Borwein, Pi and the AGM, Wiley, 1987, p. 64.
%D A000122 L. Comtet, Advanced Combinatorics, Reidel, 1974, p. 104, [5n].
%D A000122 J. H. Conway and N. J. A. Sloane, "Sphere Packings, Lattices and Groups", Springer-Verlag, p. 102.
%D A000122 N. J. Fine, Basic Hypergeometric Series and Applications, Amer. Math. Soc., 1988; p. 93, Eq. (34.1); p. 78, Eq. (32.22).
%D A000122 G. H. Hardy, Ramanujan: twelve lectures on subjects suggested by his life and work, Cambridge, University Press, 1940, p. 133.
%D A000122 G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers, Sixth Edition, Clarendon Press, Oxford, 2009, Theorem 352, p. 372.
%D A000122 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 A000122 E. T. Whittaker and G. N. Watson, A Course of Modern Analysis, Cambridge Univ. Press, 4th ed., 1963, p. 464.
%H A000122 T. D. Noe, <a href="/A000122/b000122.txt">Table of n, a(n) for n = 0..10000</a>
%H A000122 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 A000122 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 A000122 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 A000122 Michael Somos, <a href="/A010815/a010815.txt">Introduction to Ramanujan theta functions</a>
%H A000122 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/RamanujanThetaFunctions.html">Ramanujan Theta Functions</a>
%H A000122 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/JacobiThetaFunctions.html">Jacobi Theta Functions</a>
%F A000122 Expansion of eta(q^2)^5 / (eta(q)*eta(q^4))^2 in powers of q.
%F A000122 Euler transform of period 4 sequence [2, -3, 2, -1, ...].
%F A000122 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 A000122 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 A000122 G.f.: Sum_{m=-oo..oo} x^(m^2);
%F A000122 a(0) = 1; for n > 0, a(n) = 0 unless n is a square when a(n) = 2.
%F A000122 G.f.: Product_{k>0} (1 - x^(2*k))*(1 + x^(2*k-1))^2.
%F A000122 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 A000122 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 A000122 For n > 0, a(n) = 2*(floor(sqrt(n))-floor(sqrt(n-1))). - _Mikael Aaltonen_, Jan 17 2015
%F A000122 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 A000122 a(n) = A000132(n)(mod 4). - _John M. Campbell_, Jul 07 2016
%F A000122 a(n) = (2/n)*Sum_{k=1..n} A186690(k)*a(n-k), a(0) = 1. - _Seiichi Manyama_, May 27 2017
%F A000122 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 A000122 Dirichlet g.f.: 2*zeta(2s). - _Francois Oger_, Oct 26 2019 [Corrected by _Sean A. Irvine_, Nov 26 2024]
%F A000122 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 A000122 From _Peter Bala_, Sep 27 2023: (Start)
%F A000122 G.f. A(x) satisfies A(x)*A(-x) = A(-x^2)^2.
%F A000122 A(x) = Sum_{n >= 1} x^(n-1)*Product_{k >= n} 1 - (-x)^k.
%F A000122 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 A000122 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 A000122 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 A000122 add(x^(m^2),m=-10..10): seq(coeff(%,x,n), n=0..100);
%p A000122 # alternative
%p A000122 A000122 := proc(n)
%p A000122     if n = 0 then
%p A000122         1;
%p A000122     elif issqr(n) then
%p A000122         2;
%p A000122     else
%p A000122         0 ;
%p A000122     end if;
%p A000122 end proc:
%p A000122 seq(A000122(n),n=0..100) ; # _R. J. Mathar_, Feb 22 2021
%t A000122 a[ n_] := SeriesCoefficient[ EllipticTheta[ 3, 0, q], {q, 0, n}]; (* _Michael Somos_, Jul 11 2011 *)
%t A000122 CoefficientList[ Sum[ x^(m^2), {m, -(n=10), n} ], x ]
%t A000122 SquaresR[1, Range[0, 104]] (* _Robert G. Wilson v_, Jul 16 2014 *)
%t A000122 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 A000122 (4 QPochhammer[q^2]/QPochhammer[-1,-q]^2 + O[q]^101)[[3]] (* _Vladimir Reshetnikov_, Sep 16 2016 *)
%o A000122 (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 A000122 (PARI) {a(n) = issquare(n) * 2 -(n==0)}; /* _Michael Somos_, Jun 17 1999 */
%o A000122 (Magma) Basis( ModularForms( Gamma0(4), 1/2), 100) [1]; /* _Michael Somos_, Jun 10 2014 */
%o A000122 (Magma) L := Lattice("A",1); A<q> := ThetaSeries(L, 20); A; /* _Michael Somos_, Nov 13 2014 */
%o A000122 (Sage)
%o A000122 Q = DiagonalQuadraticForm(ZZ, [1])
%o A000122 Q.representation_number_list(105) # _Peter Luschny_, Jun 20 2014
%o A000122 (Julia)
%o A000122 using Nemo
%o A000122 function JacobiTheta3(len, r)
%o A000122     R, x = PolynomialRing(ZZ, "x")
%o A000122     e = theta_qexp(r, len, x)
%o A000122     [fmpz(coeff(e, j)) for j in 0:len - 1] end
%o A000122 A000122List(len) = JacobiTheta3(len, 1)
%o A000122 A000122List(105) |> println # _Peter Luschny_, Mar 12 2018
%o A000122 (Python)
%o A000122 from sympy.ntheory.primetest import is_square
%o A000122 def A000122(n): return is_square(n)<<1 if n else 1 # _Chai Wah Wu_, May 17 2023
%Y A000122 1st column of A286815. - _Seiichi Manyama_, May 27 2017
%Y A000122 Row d=1 of A122141.
%Y A000122 Cf. A002448 (theta_4). Partial sums give A001650.
%Y A000122 Cf. A010052, A010054, A089801.
%Y A000122 Cf. A000007, A004015, A004016, A008444, A008445, A008446, A008447, A008448, A008449 (Theta series of lattices A_0, A_3, A_2, A_4, ...).
%K A000122 nonn,easy,nice,changed
%O A000122 0,2
%A A000122 _N. J. A. Sloane_