What are the number of ordered m-tuples of integers,such that sum of square of elements is a given integer? Given a non-zero integer $n$,the problem is to find a m-tuple of integers,$(x_1,x_2,x_3,...,x_m)$such that the following equation is satisfied---$$\sum_{i=1}^mx_i^2=n$$
I have no idea how to approach the problem,neither can I find  exactly a solution to this,but I hope maybe counting and a bit of number theory can help.Is there any analytic solution at all?

Given $$\sum_{i=1}^m x_i^2=n$$
We can use Euclid's formula for generating Pythagorean triples
$$A=x^2-y^2\qquad B=2xy\qquad C=x^2+y^2$$
We can find a case for $m=2$ easily if we solve the $C$-function for $(y)$ and test a defined range of $m$-values to see which yield integers. For example
$$C=x^2+y^2\implies y=\sqrt{C-x^2}\qquad\text{where}\qquad \bigg\lfloor\frac{ 1+\sqrt{2C-1}}{2}\bigg\rfloor \le x \le \lfloor\sqrt{C-1}\rfloor$$
The lower limit ensures $x>y$ and the upper limit ensures $y\in\mathbb{N}$.
$$C=85\Rightarrow \bigg\lfloor\frac{ 1+\sqrt{170-1}}{2}\bigg\rfloor=6 \le x \le \lfloor\sqrt{85-1}\rfloor=9\quad\land \quad x\in\{7,9\}\Rightarrow y\in\{6,2\}$$
$$f(7,6)=(13,84,85)\quad f(9,2)=(77,36,85)$$
Side $C$ always takes the form $(C=4n+1)$ and we see that side $A$ of $F(7,6)=13=4(3)+1$ so we can try the process again. (Note: not all values of $4n+1$ are valid.)
$$C=13\implies \bigg\lfloor\frac{ 1+\sqrt{26-1}}{2}\bigg\rfloor=3 \le x \le \lfloor\sqrt{13-1}\rfloor=3\quad\text{ and we find} \quad x\in\{3\}\Rightarrow y\in\{2\}$$
$$f(3,2)=(5,12,13)\quad \text{and repeating the process for } A=5\quad f(2,1)=(3,4,5)$$
So we get a $4$-dimensional m-tupple where $3^2+4^2+12^2+84^2=85^2=7225$

There are an infinite number of these where $2\le m \le\infty$. It is easier to build them by finding a side $A$ to match a given side $C$ and,  we can always find such since all odd numbers greater than $1$ are valid $A$-values.
$$A=x^2-y^2\implies y=\sqrt{x^2-A}\qquad\text{where}\qquad  \sqrt{A+1} \le x \le \frac{A+1}{2}$$
The lower limit ensures $y\in\mathbb{N}$ and the upper limit ensures $x> y$.
$$A=15\implies \sqrt{15+1}=4\le x \le \frac{15+1}{2} =8\quad\text{ and we find} \quad x\in\{4,8\}\implies y \in\{1,7\} $$
$$fF4,1)=(15,8,17)\qquad \qquad f(8,7)=(15,112,113)$$
The example repeated yields $f(9,8)=(17,144,145)$ or $f(57,56)=(113,6384,6385)$ and this process will always work and for an unlimited number of iterations.
