login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A000118 Number of ways of writing n as a sum of 4 squares; also theta series of lattice Z^4. 131

%I

%S 1,8,24,32,24,48,96,64,24,104,144,96,96,112,192,192,24,144,312,160,

%T 144,256,288,192,96,248,336,320,192,240,576,256,24,384,432,384,312,

%U 304,480,448,144,336,768,352,288,624,576,384,96,456,744,576,336,432,960,576,192

%N Number of ways of writing n as a sum of 4 squares; also theta series of lattice Z^4.

%C a^2+b^2+c^2+d^2 is one of Ramanujan's 54 universal quaternary quadratic forms. - _Michael Somos_, Apr 01 2008

%C a(n) is also the number of quaternions q = a + bi + cj + dk, where a, b, c, d are integers, such that a^2 + b^2 + c^2 + d^2 = n (i.e., so that n is the norm of q). These are Lipschitz integer quaternions. - _Rick L. Shepherd_, Mar 27 2009

%D J. H. Conway and R. K. Guy, The Book of Numbers, New York: Springer-Verlag, 1996, ch. 8, pp. 231-2.

%D J. H. Conway and N. J. A. Sloane, Sphere Packing, Lattices and Groups, Springer-Verlag, p. 108, Eq. (49).

%D N. J. Fine, Basic Hypergeometric Series and Applications, Amer. Math. Soc., 1988; p. 78, Eq. (32.28). See also top of p. 94.

%D E. Freitag and R. Busam, Funktionentheorie 1, 4. Auflage, Springer, 2006, p. 392.

%D G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers. 3rd ed., Oxford Univ. Press, 1954, p. 314, Theorem 386.

%D Masao Koike, Modular forms on non-compact arithmetic triangle groups, preprint.

%D Carlos J. Moreno and Samuel S. Wagstaff, Jr., Sums of Squares of integers, Chapman & Hall/CRC, 2006, p. 29.

%D S. Ramanujan, Collected Papers, Chap. 20, Cambridge Univ. Press 1927 (Proceedings of the Camb. Phil. Soc., 19 (1917) 11-21).

%H T. D. Noe and N. J. A. Sloane, <a href="/A000118/b000118.txt">Table of n, a(n) for n = 0..50000</a> [First 10000 terms from T. D. Noe]

%H G. E. Andrews, S. B. Ekhad, D. Zeilberger <a href="http://arXiv.org/abs/math.CO/9206203">A Short Proof of Jacobi's Formula for the Number of Representations of an Integer as a Sum of Four Squares</a>, arXiv:math/9206203 [math.CO], 1992.

%H G. E. Andrews, S. B. Ekhad, D. Zeilberger, <a href="http://www.math.rutgers.edu/~zeilberg/mamarim/mamarimPDF/sum4sq.pdf">A Short Proof of Jacobi's Formula for the Number of Representations of an Integer as a sum of Four Squares</a>

%H Michael Ball and Dario Alejandro Alpern, <a href="http://www.alpertron.com.ar/4SQUARES.HTM">Every positive integer is a sum of four integer squares</a>

%H R. T. Bumby, <a href="http://www.math.rutgers.edu/~bumby/squares1.pdf">Sums of four squares</a>, in Number theory (New York, 1991-1995), 1-8, Springer, New York, 1996.

%H R. T. Bumby, <a href="/A000118/a000118.pdf">Sums of four squares</a> [Cached copy]

%H H. H. Chan and C. Krattenthaler, <a href="http://arXiv.org/abs/math.NT/0407061">Recent progress in the study of representations of integers as sums of squares</a>, arXiv:math/0407061 [math.NT], 2004.

%H Peter L. Clark, <a href="http://math.uga.edu/~pete/4400Minkowski.pdf">A theorem of Minkowski; the four squares theorem</a> (no date).

%H E. Grosswald, <a href="http://dx.doi.org/10.1007/978-1-4613-8566-0_10">Representations of Integers as Sums of an Even Number of Squares</a>, Springer-Verlag, NY, 1985, p. 121.

%H M. D. Hirschhorn, <a href="http://dx.doi.org/10.1090/S0002-9939-1987-0908644-9">A Simple Proof of Jacobi's Four-Square Theorem</a>, Proceedings of the American Mathematical Society, Vol. 101, No. 3 (Nov., 1987), pp. 436-438

%H G. Nebe and N. J. A. Sloane, <a href="http://www.math.rwth-aachen.de/~Gabriele.Nebe/LATTICES/Z4.html">Home page for this lattice</a>

%H S. C. Milne, <a href="http://dx.doi.org/10.1023/A:1014865816981">Infinite families of exact sums of squares formulas, Jacobi elliptic functions, continued fractions and Schur functions</a>, Ramanujan J., 6 (2002), 7-149.

%H Y. Mimura, <a href="http://www.kobepharma-u.ac.jp/~math/notes/note01.html">Almost Universal Quadratic Forms</a>.

%H Simon Plouffe, <a href="/A000118/a000118.txt">Table of n, a(n) for n=0..105817</a>

%H B. K. Spearman and K. S. Williams, <a href="http://www.pphmj.com/abstract/923.htm">The simplest arithmetic proof of Jacobi's four squares theorem</a>, Far East Journal of Mathematical Sciences 2.3 (2000): 433-440.

%H Eric van Fossen Conrad, <a href="http://www.math.ohio-state.edu/~econrad/Jacobi/sumofsq/sumofsq.html">Jacobi's Four Square Theorem</a> [Broken link?]

%H Min Wang, Zhi-Hong Sun, <a href="http://arxiv.org/abs/1511.00478">On the number of representations of n as a linear combination of four triangular numbers II</a>, arXiv:1511.00478 [math.NT], 2015.

%H Eric W. Weisstein, <a href="http://mathworld.wolfram.com/QuaternionNorm.html">"Quaternion Norm"</a>.

%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Hurwitz_quaternion">Hurwitz quaternion</a>

%H K. S. Williams, <a href="http://www.jstor.org/stable/10.4169/amer.math.monthly.120.04.329">The parents of Jacobi's four squares theorem are unique</a>, Amer. Math. Monthly, 120 (2013), 329-345.

%H <a href="/index/Su#ssq">Index entries for sequences related to sums of squares</a>

%F G.f.: theta_3(q)^4 = Product( (1-q^(2n))*(1+q^(2n-1))^2, n=1..inf )^4 = eta(-q)^8/eta(q^2)^4; eta = Dedekind's function.

%F a(n) = 8*sigma(n) - 32*sigma(n/4) for n>0, where the latter term is 0 if n is not a multiple of 4.

%F Euler transform of period 4 sequence [ 8, -12, 8, -4, ...]. - _Michael Somos_, Dec 16 2002

%F G.f. A(x) satisfies 0 = f(A(x), A(x^3), A(x^9)) where f(u, v, w) = v^4 - 30*u*v^2*w + 12*u*v*w*(u + 9*w) - u*w*(u^2 + 9*w*u + 81*w^2). - _Michael Somos_, Nov 02 2006

%F G.f. is a period 1 Fourier series which satisfies f(-1 / (4 t)) = 4 (t/i)^2 f(t) where q = exp(2 Pi i t). - _Michael Somos_, Jan 25 2008

%F For n>0, a(n)/8 is multiplicative and a(p^n)/8 = 1 + p + p^2 + ... + p^n for p an odd prime, a(2^n)/8 = 1 + 2 for n>0.

%F a(n)=8*A000203(n/A006519(n))*(2+(-1)^n). - _Benoit Cloitre_, May 16 2002

%F G.f.: 1 + 8 * Sum_{k>0} x^k / (1 + (-x)^k)^2 = 1 + 8 * Sum_{k>0} k * x^k / (1 + (-x)^k).

%F G.f. = s(2)^20/(s(1)*s(4))^8, where s(k) := subs(q=q^k, eta(q)), where eta(q) is Dedekind's function, cf. A010815. [Fine]

%F Fine gives another explicit formula for a(n) in terms of the divisors of n.

%F 8*A046897(n), n>0. - _Ralf Stephan_, Apr 02 2003

%F A096727(n) = (-1)^n * a(n). a(2*n) = A004011(n). a(2*n + 1) = A005879(n).

%F Dirichlet g.f. sum_{n>=1} a(n)/n^s = 8*(1-4^(1-s))*zeta(s)*zeta(s-1). [Ramanu. J. 7 (2003) 95-127, eq (3.2)]. - _R. J. Mathar_, Jul 02 2012

%F Average value is Pi^2/2 * n + O(sqrt(n)). - _Charles R Greathouse IV_, Feb 17 2015

%F From _Wolfdieter Lang_, Jan 14 2016: (Start)

%F For n >= 1: a(n) = 8*Sum_{d | n} b(d)*d, with b(d) = 1 if d/4 is not an integer else 0. See, e.g., the Freitag-Busam reference, p. 392.

%F For n >= 1: a(n) = 8*sigma(n) if n is odd else 24*sigma(m(n)), where m(n) is the largest odd divisor of n (see A000265), and sigma is given in A000203. See the Moreno-Wagstaff reference, Theorem 2. 6 (Jacobi), p. 29. (End)

%e G.f. = 1 + 8*q + 24*q^2 + 32*q^3 + 24*q^4 + 48*q^5 + 96*q^6 + 64*q^7 + 24*q^8 + ...

%p (add(q^(m^2),m=-10..10))^4; seq(coeff(%,q,n), n=0..50);

%t Table[SquaresR[4, n], {n, 0, 46}]

%t a[ n_] := SeriesCoefficient[ EllipticTheta[ 3, 0, q]^4, {q, 0, n}]; (* _Michael Somos_, Jun 12 2014 *)

%t a[ n_] := If[ n < 1, Boole[ n == 0], 8 Sum[ If[ Mod[ d, 4] > 0, d, 0], {d, Divisors @ n }]]; (* _Michael Somos_, Feb 20 2015 *)

%t QP = QPochhammer; CoefficientList[QP[-q]^8/QP[q^2]^4 + O[q]^60, q] (* _Jean-Fran├žois Alcover_, Nov 24 2015 *)

%o (PARI) {a(n) = if( n<1, n==0, 8 * sumdiv( n, d, if( d%4, d)))}; /* _Michael Somos_, Apr 01 2003 */

%o (PARI) {a(n) = local(A); if( n<0, 0, A = x * O(x^n); polcoeff( (eta(x^2 + A)^5 / (eta(x + A)^2 * eta(x^4 + A)^2))^4, n))}; /* _Michael Somos_, Apr 01 2008 */

%o (PARI) q='q+O('q^66); Vec((eta(q^2)^5/(eta(q)^2*eta(q^4)^2))^4) /* _Joerg Arndt_, Apr 08 2013 */

%o (PARI) a(n) = 8*sigma(n) - if (n % 4, 0, 32*sigma(n/4)); \\ _Michel Marcus_, Jul 13 2016

%o (Sage) A = ModularForms( Gamma0(4), 2, prec=57) . basis(); A[0] + 8*A[1]; # _Michael Somos_, Jun 12 2014

%o (Sage)

%o Q = DiagonalQuadraticForm(ZZ, [1]*4)

%o Q.representation_number_list(60) # _Peter Luschny_, Jun 20 2014

%o (MAGMA) A := Basis( ModularForms( Gamma0(4), 2), 57); A[1] + 8*A[2]; /* _Michael Somos_, Aug 21 2014 */

%o (Haskell)

%o a000118 0 = 1

%o a000118 n = 8 * a046897 n -- _Reinhard Zumkeller_, Aug 12 2015

%Y Cf. A000122, A000203, A000265, A004011, A005879, A046897, A096727.

%Y For number of solutions to a^2+b^2+c^2+k*d^2=n for k=1, 2, 3, 4, 5, 6, 7, 8, 12, see A000118, A236928, A236926, A236923, A236930,A236931, A236932, A236927, A236933.

%K nonn,easy,nice

%O 0,2

%A _N. J. A. Sloane_

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent | More pages
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy .

Last modified March 23 22:30 EDT 2017. Contains 283985 sequences.