OFFSET
0,2
COMMENTS
Number of lattice points inside or on the 4-sphere x^2 + y^2 + z^2 + u^2 = n. - T. D. Noe, Mar 14 2009
LINKS
T. D. Noe and Charles R Greathouse IV, Table of n, a(n) for n = 0..10000 (terms up to 1000 from Noe)
A. Walfisz, Weylsche Exponentialsummen in der neueren Zahlentheorie, ZAMM - Journal of Applied Mathematics and Mechanics / Zeitschrift für Angewandte Mathematik und Mechanik, Volume 44, Issue 12, page 607, 1964.
FORMULA
G.f.: T3(q)^4/(1-q) where T3(q) = 1 + 2*Sum_{k>=1} q^(k^2). - Joerg Arndt, Apr 08 2013
Pi^2/2 * (sqrt(n)-1)^4 < a(n) < Pi^2/2 * (sqrt(n)+1)^4 for n > 0. - Charles R Greathouse IV, Feb 17 2015
a(n) = Pi^2/2 * n^2 + O(n (log n)^(2/3)) using a result of Walfisz. - Charles R Greathouse IV, Feb 18 2015
a(n) = 1 + 8*A024916(n) - 32*A024916(floor(n/4)) by Jacobi's four-square theorem. - Peter J. Taylor, Jun 03 2020
MATHEMATICA
Accumulate[ Table[ SquaresR[4, n], {n, 0, 42}]] (* Jean-François Alcover, May 11 2012 *)
QP = QPochhammer; s = (QP[q^2]^5/(QP[q]^2*QP[q^4]^2))^4/(1-q) + O[q]^50; CoefficientList[s, q] (* Jean-François Alcover, Nov 25 2015, after Joerg Arndt *)
PROG
(PARI)
q='q+O('q^66);
Vec((eta(q^2)^5/(eta(q)^2*eta(q^4)^2))^4/(1-q))
/* Joerg Arndt, Apr 08 2013 */
(Python)
from math import isqrt
def A046895(n): return 1+((-(s:=isqrt(n))**2*(s+1)+sum((q:=n//k)*((k<<1)+q+1) for k in range(1, s+1))&-1)<<2)+(((t:=isqrt(m:=n>>2))**2*(t+1)-sum((q:=m//k)*((k<<1)+q+1) for k in range(1, t+1))&-1)<<4) # Chai Wah Wu, Jun 21 2024
CROSSREFS
KEYWORD
nonn,easy,nice
AUTHOR
STATUS
approved