%I M4092 #192 Jun 22 2024 01:39:44
%S 1,6,12,8,6,24,24,0,12,30,24,24,8,24,48,0,6,48,36,24,24,48,24,0,24,30,
%T 72,32,0,72,48,0,12,48,48,48,30,24,72,0,24,96,48,24,24,72,48,0,8,54,
%U 84,48,24,72,96,0,48,48,24,72,0,72,96,0,6,96,96,24,48,96,48,0,36,48,120
%N Theta series of simple cubic lattice; also number of ways of writing a nonnegative integer n as a sum of 3 squares (zero being allowed).
%C Number of ordered triples (i, j, k) of integers such that n = i^2 + j^2 + k^2.
%C 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
%C a(A004215(k))=0 for k=1,2,3,... but no other elements of {a(n)} are zero. - _Graeme McRae_, Jan 15 2007
%D H. Cohen, Number Theory, Vol. 1: Tools and Diophantine Equations, Springer-Verlag, 2007, p. 317.
%D J. H. Conway and N. J. A. Sloane, "Sphere Packings, Lattices and Groups", Springer-Verlag, p. 107.
%D H. Davenport, The Higher Arithmetic. Cambridge Univ. Press, 7th ed., 1999, Chapter V.
%D 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.
%D E. Grosswald, Representations of Integers as Sums of Squares. Springer-Verlag, NY, 1985, p. 54.
%D L. Kronecker, Crelle, Vol. LVII (1860), p. 248; Werke, Vol. IV, p. 188.
%D C. J. Moreno and S. S. Wagstaff, Jr., Sums of Squares of Integers, Chapman and Hall, 2006, p. 43.
%D T. Nagell, Introduction to Number Theory, Wiley, 1951, p. 194.
%D W. Sierpiński, 1925. Teorja Liczb. pp. 1-410 (p.61).
%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%D 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').
%H T. D. Noe, <a href="/A005875/b005875.txt">Table of n, a(n) for n = 0..10000</a>
%H George E. Andrews, <a href="https://georgeandrews1.github.io/pdf/320.pdf">The Bhargava-Adiga Summation and Partitions</a>, 2016. See Lemma 2.1.
%H P. T. Bateman, <a href="http://dx.doi.org/10.1090/S0002-9947-1951-0042438-4">On the representations of a number as the sum of three squares</a>, Trans. Amer. Math. Soc. 71 (1951), 70-101.
%H S. Bhargava and C. Adiga, <a href="http://dx.doi.org/10.1080/10652469408819049">A basic bilateral series summation formula and its applications</a>, Integral Transforms and Special Functions, 2 (1994), 165-184.
%H J. M. Borwein, <a href="http://www.cecm.sfu.ca/~kkchoi/paper.html">K-K S. Choi</a>, <a href="http://dx.doi.org/10.1023/A:1026230709945">On Dirichlet series for sums of squares</a>, Raman. J. 7 (2003) 95-127
%H S. K. K. Choi, A. V. Kumchev, and R. Osburn, <a href="https://arxiv.org/abs/math/0502007">On sums of three squares</a>, arXiv:math/0502007 [math.NT], 2005.
%H M. Doring, J. Haidenbauer, U.-G. Meissner, and A. Rusetsky, <a href="http://arxiv.org/abs/1108.0676">Dynamical coupled-channel approaches on a momentum lattice</a>, arXiv:1108.0676 [hep-lat], 2011.
%H J. A. Ewell, <a href="http://dx.doi.org/10.1155/S0161171200003902">Recursive determination of the enumerator for sums of three squares</a>, Internat. J. Math. and Math. Sci, 24 (2000), 529-532.
%H O. Fraser and B. Gordon, <a href="http://www.jstor.org/stable/2317949">On representing a square as the sum of three squares</a>, Amer. Math. Monthly, 76 (1969), 922-923.
%H M. D. Hirschhorn and J. A. Sellers, <a href="https://doi.org/10.1016/S0012-365X(98)00288-X">On Representations of a Number as a Sum of Three Squares</a>, Discrete Mathematics 199 (1999), 85-101.
%H M. D. Hirschhorn and J. A. Sellers, <a href="http://web.maths.unsw.edu.au/~mikeh/webpapers/paper63.pdf">On Representations Of A Number As A Sum Of Three Squares</a>
%H A. Martinez Torres, L. R. Dai, C. Koren, D. Jido, and E. Oset, <a href="http://arxiv.org/abs/1109.0396">The KD, eta D_s interaction in finite volume and the D_{s^*0}(2317) resonance</a>, arXiv:1109.0396 [hep-lat], 2011.
%H R. J. Mathar, <a href="http://arxiv.org/abs/1309.3705">Hierarchical Subdivision of the Simple Cubic Lattice</a>, arXiv:1309.3705 [math.MG], 2013.
%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 J. L. Mordell, <a href="http://projecteuclid.org/euclid.mmj/1028998438">The Representation Of Integers By Three Positive Squares</a>, Michigan Math. J. 7(3): 289-290 (1960).
%H Eric T. Mortenson, <a href="https://arxiv.org/abs/1702.01627">A Kronecker-type identity and the representations of a number as a sum of three squares</a>, arXiv:1702.01627 [math.NT], 2017.
%H G. Nebe and N. J. A. Sloane, <a href="http://www.math.rwth-aachen.de/~Gabriele.Nebe/LATTICES/cubicP.html">Home page for this lattice</a>
%H Michael Somos, <a href="/A010815/a010815.txt">Introduction to Ramanujan theta functions</a>
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/ThetaSeries.html">Theta Series</a>
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/RamanujanThetaFunctions.html">Ramanujan Theta Functions</a>
%H <a href="/index/Su#ssq">Index entries for sequences related to sums of squares</a>
%F A number n is representable as the sum of 3 squares iff n is not of the form 4^a (8k+7) (cf. A000378).
%F There is a classical formula (essentially due to Gauss):
%F 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).
%F 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
%F 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].
%F "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.]
%F a(n) = Sum_{d^2|n} b(n/d^2), where b() = A074590() gives the number of primitive solutions.
%F Expansion of phi(q)^3 in powers of q where phi() is a Ramanujan theta function. - _Michael Somos_, Oct 25 2006.
%F Euler transform of period 4 sequence [ 6, -9, 6, -3, ...]. - _Michael Somos_, Oct 25 2006
%F G.f.: (Sum_{k in Z} x^(k^2))^3.
%F a(8*n + 7) = 0. a(4*n) = a(n).
%F 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
%F a(4*n + 2) = 12 * A045828(n). - _Michael Somos_, Sep 03 2014
%F a(n) = (-1)^n * A213384(n). - _Michael Somos_, May 21 2015
%F a(n) = (6/n)*Sum_{k=1..n} A186690(k)*a(n-k), a(0) = 1. - _Seiichi Manyama_, May 27 2017
%F a(n) = A004018(n) + 2*Sum_{k=1..floor(sqrt(n))} A004018(n - k^2). - _Daniel Suteu_, Aug 27 2021
%e 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.
%e 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 + ...
%p (sum(x^(m^2),m=-10..10))^3; seq(coeff(%,x,n), n=0..50);
%p Alternative:
%p A005875list := proc(len) series(JacobiTheta3(0, x)^3, x, len+1);
%p seq(coeff(%, x, j), j=0..len-1) end: A005875list(75); # _Peter Luschny_, Oct 02 2018
%t SquaresR[3,Range[0,80]] (* _Harvey P. Dale_, Jul 21 2011 *)
%t a[ n_] := SeriesCoefficient[ EllipticTheta[ 3, 0, q]^3, {q, 0, n}]; (* _Michael Somos_, Jun 25 2014 *)
%t a[ n_] := Length @ FindInstance[ n == x^2 + y^2 + z^2, {x, y, z}, Integers, 10^9]; (* _Michael Somos_, May 21 2015 *)
%t 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 *)
%o (PARI) {a(n) = if( n<0, 0, polcoeff( sum( k=1, sqrtint(n), 2 * x^k^2, 1 + x * O(x^n))^3, n))};
%o (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 */
%o (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 */
%o (Sage)
%o Q = DiagonalQuadraticForm(ZZ, [1]*3)
%o Q.representation_number_list(75) # _Peter Luschny_, Jun 20 2014
%o (Magma) Basis( ModularForms( Gamma1(4), 3/2), 75) [1]; /* _Michael Somos_, Jun 25 2014 */
%o (Julia) # JacobiTheta3 is defined in A000122.
%o A005875List(len) = JacobiTheta3(len, 3)
%o A005875List(75) |> println # _Peter Luschny_, Mar 12 2018
%o (Python)
%o # uses Python code for A004018
%o from math import isqrt
%o 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
%Y Row d=3 of A122141 and of A319574, 3rd column of A286815.
%Y Cf. A074590 (primitive solutions), A117609 (partial sums), A004215 (positions of zeros).
%Y Analog for 4 squares: A000118.
%Y x^2+y^2+k*z^2: A005875, A014455, A034933, A169783, A169784.
%Y Cf. A000164, A004013, A004015, A008443, A045828, A045831, A045834, A213384.
%Y Ramanujan theta functions: f(q) (see A121373), phi(q) (A000122), psi(q) (A010054), chi(q) (A000700).
%K nonn,easy,nice
%O 0,2
%A _N. J. A. Sloane_
%E More terms from _James A. Sellers_, Aug 22 2000