Nearest Neighbor on a 3d Grid

217 Views Asked by At

In Solid State Physics we were analyzing a crystal with a simple cubic unit cell and wanted to compute the number of first nearest neighbors, second nearest neighbors and so on and their corresponding distances.

I can see this is related to the number of solutions of: $$x^2+y^2+z^2=r_n^2$$ with $x,y,z\in\mathbb{Z}$ the number of steps in each direction and $r_n$ the distance of the $n$-nearest neighbor.

However, that time we used an approximation to solve this. I am wondering if there is a nice exact expression for this? or any known result?