OFFSET
0,2
COMMENTS
Number of ordered triples (i, j, k) of integers such that n = i^2 + j^2 + k^2.
The Madelung Coulomb energy for alternating unit charges in the simple cubic lattice is Sum_{n>=1} (-1)^n*a(n)/sqrt(n) = -A085469. - R. J. Mathar, Apr 29 2006
a(A004215(k))=0 for k=1,2,3,... but no other elements of {a(n)} are zero. - Graeme McRae, Jan 15 2007
REFERENCES
H. Cohen, Number Theory, Vol. 1: Tools and Diophantine Equations, Springer-Verlag, 2007, p. 317.
J. H. Conway and N. J. A. Sloane, "Sphere Packings, Lattices and Groups", Springer-Verlag, p. 107.
H. Davenport, The Higher Arithmetic. Cambridge Univ. Press, 7th ed., 1999, Chapter V.
L. E. Dickson, History of the Theory of Numbers. Carnegie Institute Public. 256, Washington, DC, Vol. 1, 1919; Vol. 2, 1920; Vol. 3, 1923, see vol. 3, p. 109.
E. Grosswald, Representations of Integers as Sums of Squares. Springer-Verlag, NY, 1985, p. 54.
L. Kronecker, Crelle, Vol. LVII (1860), p. 248; Werke, Vol. IV, p. 188.
C. J. Moreno and S. S. Wagstaff, Jr., Sums of Squares of Integers, Chapman and Hall, 2006, p. 43.
T. Nagell, Introduction to Number Theory, Wiley, 1951, p. 194.
W. Sierpiński, 1925. Teorja Liczb. pp. 1-410 (p.61).
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
H. J. S. Smith, Report on the Theory of Numbers, reprinted in Vol. 1 of his Collected Math. Papers, Chelsea, NY, 1979, see p. 338, Eq. (B').
LINKS
T. D. Noe, Table of n, a(n) for n = 0..10000
George E. Andrews, The Bhargava-Adiga Summation and Partitions, 2016. See Lemma 2.1.
P. T. Bateman, On the representations of a number as the sum of three squares, Trans. Amer. Math. Soc. 71 (1951), 70-101.
S. Bhargava and C. Adiga, A basic bilateral series summation formula and its applications, Integral Transforms and Special Functions, 2 (1994), 165-184.
J. M. Borwein, K-K S. Choi, On Dirichlet series for sums of squares, Raman. J. 7 (2003) 95-127
S. K. K. Choi, A. V. Kumchev, and R. Osburn, On sums of three squares, arXiv:math/0502007 [math.NT], 2005.
M. Doring, J. Haidenbauer, U.-G. Meissner, and A. Rusetsky, Dynamical coupled-channel approaches on a momentum lattice, arXiv:1108.0676 [hep-lat], 2011.
J. A. Ewell, Recursive determination of the enumerator for sums of three squares, Internat. J. Math. and Math. Sci, 24 (2000), 529-532.
O. Fraser and B. Gordon, On representing a square as the sum of three squares, Amer. Math. Monthly, 76 (1969), 922-923.
M. D. Hirschhorn and J. A. Sellers, On Representations of a Number as a Sum of Three Squares, Discrete Mathematics 199 (1999), 85-101.
M. D. Hirschhorn and J. A. Sellers, On Representations Of A Number As A Sum Of Three Squares
A. Martinez Torres, L. R. Dai, C. Koren, D. Jido, and E. Oset, The KD, eta D_s interaction in finite volume and the D_{s^*0}(2317) resonance, arXiv:1109.0396 [hep-lat], 2011.
R. J. Mathar, Hierarchical Subdivision of the Simple Cubic Lattice, arXiv:1309.3705 [math.MG], 2013.
S. C. Milne, Infinite families of exact sums of squares formulas, Jacobi elliptic functions, continued fractions and Schur functions, Ramanujan J., 6 (2002), 7-149.
J. L. Mordell, The Representation Of Integers By Three Positive Squares, Michigan Math. J. 7(3): 289-290 (1960).
Eric T. Mortenson, A Kronecker-type identity and the representations of a number as a sum of three squares, arXiv:1702.01627 [math.NT], 2017.
G. Nebe and N. J. A. Sloane, Home page for this lattice
Michael Somos, Introduction to Ramanujan theta functions
Eric Weisstein's World of Mathematics, Theta Series
Eric Weisstein's World of Mathematics, Ramanujan Theta Functions
FORMULA
A number n is representable as the sum of 3 squares iff n is not of the form 4^a (8k+7) (cf. A000378).
There is a classical formula (essentially due to Gauss):
For sums of 3 squares r_3(n): write (uniquely) -n=D(2^vf)^2, with D<0 fundamental discriminant, f odd, v>=-1. Then r_3(n) = 12L((D/.),0)(1-(D/2)) Sum_{d | f} mu(d)(D/d)sigma(f/d).
Here mu is the Moebius function, (D/2) and (D/d) are Kronecker-Legendre symbols, sigma is the sum of divisors function, L((D/.),0)=h(D)/(w(D)/2) is the value at 0 of the L function of the quadratic character (D/.), equal to the class number h(D) divided by 2 or 3 in the special cases D=-4 and -3. - Henri Cohen (Henri.Cohen(AT)math.u-bordeaux1.fr), May 12 2010
a(n) = 3*T(n) if n == 1,2,5,6 mod 8, = 2*T(n) if n == 3 mod 8, = 0 if n == 7 mod 8 and = a(n/4) if n == 0 mod 4, where T(n) = A117726(n). [Moreno-Wagstaff].
"If 12E(n) is the number of representations of n as a sum of three squares, then E(n) = 2F(n) - G(n) where G(n) = number of classes of determinant -n, F(n) = number of uneven classes." - Dickson, quoting Kronecker. [Cf. A117726.]
a(n) = Sum_{d^2|n} b(n/d^2), where b() = A074590() gives the number of primitive solutions.
Expansion of phi(q)^3 in powers of q where phi() is a Ramanujan theta function. - Michael Somos, Oct 25 2006.
Euler transform of period 4 sequence [ 6, -9, 6, -3, ...]. - Michael Somos, Oct 25 2006
G.f.: (Sum_{k in Z} x^(k^2))^3.
a(8*n + 7) = 0. a(4*n) = a(n).
a(n) = A004015(2*n) = A014455(2*n) = A004013(4*n) = A169783(4*n). a(4*n + 1) = 6 * A045834(n). a(8*n + 3) = 8 * A008443(n). a(8*n + 5) = 24 * A045831(n). - Michael Somos, Jun 03 2012
a(4*n + 2) = 12 * A045828(n). - Michael Somos, Sep 03 2014
a(n) = (-1)^n * A213384(n). - Michael Somos, May 21 2015
a(n) = (6/n)*Sum_{k=1..n} A186690(k)*a(n-k), a(0) = 1. - Seiichi Manyama, May 27 2017
EXAMPLE
Order and signs are taken into account: a(1) = 6 from 1 = (+-1)^2 + 0^2 + 0^2, a(2) = 12 from 2 = (+-1)^2 + (+-1)^2 + 0^2; a(3) = 8 from 3 = (+-1)^2 + (+-1)^2 + (+-1)^2, etc.
G.f. = 1 + 6*q + 12*q^2 + 8*q^3 + 6*q^4 + 24*q^5 + 24*q^6 + 12*q^8 + 30*q^9 + 24*q^10 + ...
MAPLE
(sum(x^(m^2), m=-10..10))^3; seq(coeff(%, x, n), n=0..50);
Alternative:
A005875list := proc(len) series(JacobiTheta3(0, x)^3, x, len+1);
seq(coeff(%, x, j), j=0..len-1) end: A005875list(75); # Peter Luschny, Oct 02 2018
MATHEMATICA
SquaresR[3, Range[0, 80]] (* Harvey P. Dale, Jul 21 2011 *)
a[ n_] := SeriesCoefficient[ EllipticTheta[ 3, 0, q]^3, {q, 0, n}]; (* Michael Somos, Jun 25 2014 *)
a[ n_] := Length @ FindInstance[ n == x^2 + y^2 + z^2, {x, y, z}, Integers, 10^9]; (* Michael Somos, May 21 2015 *)
QP = QPochhammer; CoefficientList[(QP[q^2]^5/(QP[q]*QP[q^4])^2)^3 + O[q]^80, q] (* Jean-François Alcover, Nov 24 2015 *)
PROG
(PARI) {a(n) = if( n<0, 0, polcoeff( sum( k=1, sqrtint(n), 2 * x^k^2, 1 + x * O(x^n))^3, n))};
(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)^3, n))}; /* Michael Somos, Jun 03 2012 */
(PARI) {a(n) = my(G); if( n<0, 0, G = [ 1, 0, 0; 0, 1, 0; 0, 0, 1]; polcoeff( 1 + 2 * x * Ser( qfrep( G, n)), n))}; /* Michael Somos, May 21 2015 */
(Sage)
Q = DiagonalQuadraticForm(ZZ, [1]*3)
Q.representation_number_list(75) # Peter Luschny, Jun 20 2014
(Magma) Basis( ModularForms( Gamma1(4), 3/2), 75) [1]; /* Michael Somos, Jun 25 2014 */
(Julia) # JacobiTheta3 is defined in A000122.
A005875List(len) = JacobiTheta3(len, 3)
A005875List(75) |> println # Peter Luschny, Mar 12 2018
(Python)
# uses Python code for A004018
from math import isqrt
def A005875(n): return A004018(n)+(sum(A004018(n-k**2) for k in range(1, isqrt(n)+1))<<1) # Chai Wah Wu, Jun 21 2024
CROSSREFS
KEYWORD
nonn,easy,nice
AUTHOR
EXTENSIONS
More terms from James A. Sellers, Aug 22 2000
STATUS
approved