login
The OEIS is supported by the many generous donors 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 four-dimensional cubic lattice Z^4. 198

%I #191 Oct 27 2023 18:19:52

%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 four-dimensional cubic 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

%C Number 5 and 35 of the 126 eta-quotients listed in Table 1 of Williams 2012. - _Michael Somos_, Nov 10 2018

%C This is the convolution square of A004018. - _Pierre Abbat_, May 15 2023

%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 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 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 George E. Andrews, S. B. Ekhad, and D. Zeilberger <a href="https://arxiv.org/abs/math/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 George E. Andrews, S. B. Ekhad, and D. Zeilberger, <a href="https://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 George E. Andrews, Sumit Kumar Jha, and J. López-Bonilla, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL26/Jha/jha25.html">Sums of Squares, Triangular Numbers, and Divisor Sums</a>, Journal of Integer Sequences, Vol. 26 (2023), Article 23.2.5.

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

%H Cristina Ballantine and Mircea Merca, <a href="https://doi.org/10.1007/s00009-019-1301-6">Jacobi's four and eight squares theorems and partitions into distinct parts</a>, Mediterr. J. Math 16 (2009) 26.

%H R. T. Bumby, <a href="https://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="https://arxiv.org/abs/math/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="https://web.archive.org/web/20200922002454/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="https://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 Masao Koike, <a href="https://oeis.org/A004016/a004016.pdf">Modular forms on non-compact arithmetic triangle groups</a>, Unpublished manuscript [Extensively annotated with OEIS A-numbers by N. J. A. Sloane, Feb 14 2021. I wrote 2005 on the first page but the internal evidence suggests 1997.]

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

%H S. C. Milne, <a href="https://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="https://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="https://web.archive.org/web/20060907112703/http://www.math.ohio-state.edu/~econrad/Jacobi/sumofsq/sumofsq.html">Jacobi's Four Square Theorem</a>

%H Min Wang and Zhi-Hong Sun, <a href="https://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="https://mathworld.wolfram.com/QuaternionNorm.html">Quaternion Norm</a>.

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

%H K. S. Williams, <a href="https://dx.doi.org/10.1142/S1793042112500595">Fourier series of a class of eta quotients</a>, Int. J. Number Theory 8 (2012), no. 4, 993-1004.

%H K. S. Williams, <a href="https://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_{n>=1} (1-q^(2n))*(1+q^(2n-1))^2)^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 a(n) = 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)

%F a(n) = (8/n)*Sum_{k=1..n} A186690(k)*a(n-k), a(0) = 1. - _Seiichi Manyama_, May 27 2017

%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 + ...

%e a(1)=8 counts 1 = 1^2 + 0^2 + 0^2 + 0^2 = 0^2 + 1^2 + 0^2 + 0^2 = 0^2 + 0^2 + 1^2 + 0^2 = 0^2 + 0^2 + 0^2 + 1^2 and 4 more sums where 1^2 is replaced by (-1)^2. - _R. J. Mathar_, May 16 2023

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

%p # Alternative:

%p A000118list := proc(len) series(JacobiTheta3(0, x)^4, x, len+1);

%p seq(coeff(%, x, j), j=0..len-1) end: A000118list(57); # _Peter Luschny_, Oct 02 2018

%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

%o (Julia) # JacobiTheta3 is defined in A000122.

%o A000118List(len) = JacobiTheta3(len, 4)

%o A000118List(57) |> println # _Peter Luschny_, Mar 12 2018

%o (Python)

%o from sympy import divisors

%o def a(n): return 1 if n==0 else 8*sum(d for d in divisors(n) if d%4 != 0)

%o print([a(n) for n in range(57)]) # _Michael S. Branicky_, Jan 08 2021

%o (Python)

%o from sympy import divisor_sigma

%o def A000118(n): return 1 if n == 0 else 8*divisor_sigma(n) if n % 2 else 24*divisor_sigma(int(bin(n)[2:].rstrip('0'),2)) # _Chai Wah Wu_, Jun 27 2022

%Y Row d=4 of A122141 and of A319574, 4th column of A286815.

%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 | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 13:36 EDT 2024. Contains 371970 sequences. (Running on oeis4.)