TITLE: Integer lattice points on a sphere
QUESTION [20 upvotes]: 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$?

REPLY [8 votes]: There is an expression for this, if $r$ is an integer. See projecteuclid. Also, OEIS A016725.
I am not a number theorist. Just discovered this while searching for something else.