A016725 Number of integer solutions to x^2+y^2+z^2 = n^2, allowing zeros and distinguishing signs and order.
1, 6, 6, 30, 6, 30, 30, 54, 6, 102, 30, 78, 30, 78, 54, 150, 6, 102, 102, 126, 30, 270, 78, 150, 30, 150, 78, 318, 54, 174, 150, 198, 6, 390, 102, 270, 102, 222, 126, 390, 30, 246, 270, 270, 78, 510, 150, 294, 30, 390, 150, 510, 78, 318, 318, 390, 54, 630, 174, 366
Offset: 0
Examples
1 + 6*x + 6*x^2 + 30*x^3 + 6*x^4 + 30*x^5 + 30*x^6 + 54*x^7 + 6*x^8 + ...
Links
- T. D. Noe, Table of n, a(n) for n = 0..10000
- Michael Gilleland, Some Self-Similar Integer Sequences
- Werner Hürlimann, Exact and Asymptotic Evaluation of the Number of Distinct Primitive Cuboids, Journal of Integer Sequences, Vol. 18 (2015), Article 15.2.5.
- Jean Lagrange, Décomposition d'un entier en somme de carrés et fonction multiplicative, Séminaire Delange-Pisot-Poitou. Théorie des nombres, 14 no. 1 (1972-1973), Exp. No. 1, 5 p.
- C. D. Olds, On the representations, N_3(n^2), Bull. Amer. Math. Soc. 47 (1941), 499-503.
- Eric Weisstein's World of Mathematics, Sum of Squares Function
Programs
-
Maple
for n from 0 to 60 do s:=0: for x from -n to n do for y from -n to n do for z from -n to n do if (x^2+y^2+z^2) = n^2 then s:=s+1 fi od od od: printf("%d, ",s) od: # C. Ronaldo (aga_new_ac(AT)hotmail.com), Dec 13 2004
-
Mathematica
SquaresR[3, Range[0,100]^2]
-
PARI
{a(n) = if( n<1, n==0, polcoeff( sum( k=1, n, 2 * x^k^2, 1 + x * O(x^n^2))^3, n^2))} /* Michael Somos, Nov 18 2011 */
-
PARI
{a(n) = local(A, p, e); if( n<1, n==0, A = factor(n); 6 * prod( k=1, matsize(A)[1], if( p = A[k, 1], e = A[k, 2]; if( p==2, 1, p^e + if( p%4 == 1, 0, 2 * (p^e - 1) / (p - 1))))))} /* Michael Somos, Nov 18 2011 */
Formula
a(n) = 6 * b(n) if n>0 where b(n) is multiplicative with b(2^e) = 1, b(p^e) = p^e if p == 1 (mod 4), b(p^e) = p^e + 2 * (p^e - 1) / (p - 1) if p == 3 (mod 4). - Michael Somos, Nov 18 2011
a(n) = A005875(n^2).
a(n) = [x^(n^2)] theta_3(x)^3, where theta_3() is the Jacobi theta function. - Ilya Gutkovskiy, Apr 20 2018
Extensions
Revised description from C. Ronaldo (aga_new_ac(AT)hotmail.com), Dec 13 2004
Comments