|
|
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
|
|
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
|
R. T. Bumby, Sums of four squares, in Number theory (New York, 1991-1995), 1-8, Springer, New York, 1996.
|
|
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.
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.
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
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)
|
|
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)
(Magma) A := Basis( ModularForms( Gamma0(4), 2), 57); A[1] + 8*A[2]; /* Michael Somos, Aug 21 2014 */
(Haskell)
a000118 0 = 1
(Julia) # JacobiTheta3 is defined in A000122.
A000118List(len) = JacobiTheta3(len, 4)
(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)
(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
|
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.
|
|
KEYWORD
|
nonn,easy,nice
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|