# Integer lattice points on a sphere

Suppose we have a sphere centered at the origin of $\mathbb{R^{n}}$ with radius $r$. Are there known theorems that state the number of integer lattice points that lie on the sphere? It seems like this is something someone has studied so hopefully someone here could point me to some references.

Also, consider the lattice points that do lie on this sphere. Is there a known greatest lower bound to the number of neighbours (integer lattice points lying Euclidean distance $1$ away) of these lattice points that do not lie in the sphere as a function of $r$ and $n$?

-
The 2D problem is known as the Gauss Circle Problem. I think even less is known about the 3D version. –  Bill Cook Nov 27 '11 at 23:07
I think the Gauss Circle Problem pertains to the number of points that lie inside the sphere, just not the ones on the surface. –  user13255 Nov 27 '11 at 23:09
You're right. Not the same thing (but related). :) –  Bill Cook Nov 27 '11 at 23:12
There are effective estimates known derived using Harmonic analytic techniques, see here. –  Ragib Zaman Nov 27 '11 at 23:17
–  David Speyer Nov 28 '11 at 1:45

The problem of the precise number that lies on the surface is of a number theoretic nature. It has to do with the number of ways we can express an integer as the sum of $n$ squares. A lot of modern and classical work in number theory relates to this question.
The other problem, where we count all the points inside instead of just those on the boundary, is of a different flavour. If $a_r$ denotes the number of lattice points on the surface of the 3-d sphere with radius $r$ centered at the origin, then each individual $a_r$ fluctuates quite erratically. If we study the sum $a_1 + a_2 + \cdots + a_r$ instead, then we get smoother behavior and analytic methods can be applied. For example see here ).
There is an expression for this, if $r$ is an integer. See projecteuclid. Also, OEIS A016725.