I believe that it was proven by Jacobi using theta functions that every positive integer is the sum of four squares. That is the reason for the appearance of n^2+1 for four dimensions. Any dimension greater than four would give the same result. The results for less than four are not so simple. Shalom, Michael