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
1, 8, 24, 32, 24, 48, 96, 64, 24, 104, 144, 96, 96, 112, 192, 192, 24, 144, 312, 160, 144, 256, 288, 192, 96, 248, 336, 320, 192, 240, 576, 256, 24, 384, 432, 384, 312, 304, 480, 448, 144, 336, 768, 352, 288, 624, 576, 384, 96, 456, 744, 576, 336, 432, 960, 576, 192 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,2
COMMENTS
a^2 + b^2 + c^2 + d^2 is one of Ramanujan's 54 universal quaternary quadratic forms. - Michael Somos, Apr 01 2008
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
Number 5 and 35 of the 126 eta-quotients listed in Table 1 of Williams 2012. - Michael Somos, Nov 10 2018
This is the convolution square of A004018. - Pierre Abbat, May 15 2023
REFERENCES
J. H. Conway and R. K. Guy, The Book of Numbers, New York: Springer-Verlag, 1996, ch. 8, pp. 231-2.
J. H. Conway and N. J. A. Sloane, Sphere Packing, Lattices and Groups, Springer-Verlag, p. 108, Eq. (49).
N. J. Fine, Basic Hypergeometric Series and Applications, Amer. Math. Soc., 1988; p. 78, Eq. (32.28). See also top of p. 94.
E. Freitag and R. Busam, Funktionentheorie 1, 4. Auflage, Springer, 2006, p. 392.
G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers. 3rd ed., Oxford Univ. Press, 1954, p. 314, Theorem 386.
Carlos J. Moreno and Samuel S. Wagstaff, Jr., Sums of Squares of integers, Chapman & Hall/CRC, 2006, p. 29.
S. Ramanujan, Collected Papers, Chap. 20, Cambridge Univ. Press 1927 (Proceedings of the Camb. Phil. Soc., 19 (1917) 11-21).
LINKS
N. J. A. Sloane, Table of n, a(n) for n = 0..50000 (first 10000 terms from T. D. Noe)
George E. Andrews, S. B. Ekhad, and D. Zeilberger A Short Proof of Jacobi's Formula for the Number of Representations of an Integer as a Sum of Four Squares, arXiv:math/9206203 [math.CO], 1992.
George E. Andrews, Sumit Kumar Jha, and J. López-Bonilla, Sums of Squares, Triangular Numbers, and Divisor Sums, Journal of Integer Sequences, Vol. 26 (2023), Article 23.2.5.
Michael Ball and Dario Alejandro Alpern, Every positive integer is a sum of four integer squares
Cristina Ballantine and Mircea Merca, Jacobi's four and eight squares theorems and partitions into distinct parts, Mediterr. J. Math 16 (2009) 26.
R. T. Bumby, Sums of four squares, in Number theory (New York, 1991-1995), 1-8, Springer, New York, 1996.
R. T. Bumby, Sums of four squares [Cached copy]
H. H. Chan and C. Krattenthaler, Recent progress in the study of representations of integers as sums of squares, arXiv:math/0407061 [math.NT], 2004.
E. Grosswald, Representations of Integers as Sums of an Even Number of Squares, Springer-Verlag, NY, 1985, p. 121.
M. D. Hirschhorn, A Simple Proof of Jacobi's Four-Square Theorem, Proceedings of the American Mathematical Society, Vol. 101, No. 3 (Nov., 1987), pp. 436-438
Masao Koike, Modular forms on non-compact arithmetic triangle groups, 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.]
G. Nebe and N. J. A. Sloane, The lattice Z4
B. K. Spearman and K. S. Williams, The simplest arithmetic proof of Jacobi's four squares theorem, Far East Journal of Mathematical Sciences 2.3 (2000): 433-440.
Eric van Fossen Conrad, Jacobi's Four Square Theorem
Min Wang and Zhi-Hong Sun, On the number of representations of n as a linear combination of four triangular numbers II, arXiv:1511.00478 [math.NT], 2015.
Eric W. Weisstein, Quaternion Norm.
K. S. Williams, Fourier series of a class of eta quotients, Int. J. Number Theory 8 (2012), no. 4, 993-1004.
K. S. Williams, The parents of Jacobi's four squares theorem are unique, Amer. Math. Monthly, 120 (2013), 329-345.
FORMULA
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.
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.
Euler transform of period 4 sequence [8, -12, 8, -4, ...]. - Michael Somos, Dec 16 2002
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
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
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.
a(n) = 8*A000203(n/A006519(n))*(2 + (-1)^n). - Benoit Cloitre, May 16 2002
G.f.: 1 + 8*Sum_{k>0} x^k / (1 + (-x)^k)^2 = 1 + 8*Sum_{k>0} k * x^k / (1 + (-x)^k).
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]
Fine gives another explicit formula for a(n) in terms of the divisors of n.
a(n) = 8*A046897(n), n > 0. - Ralf Stephan, Apr 02 2003
A096727(n) = (-1)^n * a(n). a(2*n) = A004011(n). a(2*n + 1) = A005879(n).
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
Average value is (Pi^2/2)*n + O(sqrt(n)). - Charles R Greathouse IV, Feb 17 2015
From Wolfdieter Lang, Jan 14 2016: (Start)
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.
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)
a(n) = (8/n)*Sum_{k=1..n} A186690(k)*a(n-k), a(0) = 1. - Seiichi Manyama, May 27 2017
EXAMPLE
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 + ...
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
MAPLE
(add(q^(m^2), m=-10..10))^4; seq(coeff(%, q, n), n=0..50);
# Alternative:
A000118list := proc(len) series(JacobiTheta3(0, x)^4, x, len+1);
seq(coeff(%, x, j), j=0..len-1) end: A000118list(57); # Peter Luschny, Oct 02 2018
MATHEMATICA
Table[SquaresR[4, n], {n, 0, 46}]
a[ n_] := SeriesCoefficient[ EllipticTheta[ 3, 0, q]^4, {q, 0, n}]; (* Michael Somos, Jun 12 2014 *)
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 *)
QP = QPochhammer; CoefficientList[QP[-q]^8/QP[q^2]^4 + O[q]^60, q] (* Jean-François Alcover, Nov 24 2015 *)
PROG
(PARI) {a(n) = if( n<1, n==0, 8 * sumdiv( n, d, if( d%4, d)))}; /* Michael Somos, Apr 01 2003 */
(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 */
(PARI) q='q+O('q^66); Vec((eta(q^2)^5/(eta(q)^2*eta(q^4)^2))^4) /* Joerg Arndt, Apr 08 2013 */
(PARI) a(n) = 8*sigma(n) - if (n % 4, 0, 32*sigma(n/4)); \\ Michel Marcus, Jul 13 2016
(Sage) A = ModularForms( Gamma0(4), 2, prec=57) . basis(); A[0] + 8*A[1]; # Michael Somos, Jun 12 2014
(Sage)
Q = DiagonalQuadraticForm(ZZ, [1]*4)
Q.representation_number_list(60) # Peter Luschny, Jun 20 2014
(Magma) A := Basis( ModularForms( Gamma0(4), 2), 57); A[1] + 8*A[2]; /* Michael Somos, Aug 21 2014 */
(Haskell)
a000118 0 = 1
a000118 n = 8 * a046897 n -- Reinhard Zumkeller, Aug 12 2015
(Julia) # JacobiTheta3 is defined in A000122.
A000118List(len) = JacobiTheta3(len, 4)
A000118List(57) |> println # Peter Luschny, Mar 12 2018
(Python)
from sympy import divisors
def a(n): return 1 if n==0 else 8*sum(d for d in divisors(n) if d%4 != 0)
print([a(n) for n in range(57)]) # Michael S. Branicky, Jan 08 2021
(Python)
from sympy import divisor_sigma
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
CROSSREFS
Row d=4 of A122141 and of A319574, 4th column of A286815.
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.
Sequence in context: A162829 A303796 A175368 * A096727 A028660 A028644
KEYWORD
nonn,easy,nice
AUTHOR
STATUS
approved

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 February 27 10:59 EST 2024. Contains 370378 sequences. (Running on oeis4.)