OFFSET
0,2
COMMENTS
Hurwitz found a formula for a(n). See the paper by Olds.
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
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
EXAMPLE
1 + 6*x + 6*x^2 + 30*x^3 + 6*x^4 + 30*x^5 + 30*x^6 + 54*x^7 + 6*x^8 + ...
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]
PROG
(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 */
CROSSREFS
KEYWORD
nonn,look
AUTHOR
csvcjld(AT)nomvst.lsumc.edu
EXTENSIONS
Revised description from C. Ronaldo (aga_new_ac(AT)hotmail.com), Dec 13 2004
STATUS
approved