164*. Find four whole (positive) numbers such that the square of each of them, added to the sum of the other three, is also a perfect square.

Find four whole (positive) numbers such that the square of each of them, added to the sum of the other three, is also a perfect square.
164. The task is to solve the following system of equations in positive integers ($x, y, z$ and $u$ are the unknowns):

$$
\begin{aligned}
& x^{2}+y+z+u=(x+v)^{2} \\
& y^{2}+x+z+u=(y+w)^{2} \\
& z^{2}+x+y+u=(z+t)^{2} \\
& u^{2}+x+y+z=(u+s)^{2}
\end{aligned}
$$

or

$$
\left.\begin{array}{l}
y+z+u=2 v x+v^{2} \\
x+z+u=2 w y+w^{2} \\
x+y+u=2 t z+t^{2} \\
x+y+z=2 s u+s^{2}
\end{array}\right\}
$$

By adding all the equations (""), we get:

$$
\begin{aligned}
& (2 v-3) x+(2 w-3) y+(2 t-3) z+(2 s-3) u+v^{2}+ \\
& +w^{2}+t^{2}+s^{2}=0
\end{aligned}
$$

First, note that from the equality (**) it follows that at least one of the numbers $2 v-3, 2 w-3, 2 t-3, 2 s-3$ is negative, otherwise we would have a sum of positive numbers on the left side of this equation. Suppose, for example, that $2 v-3 < 0$ and $t \neq 1$ (since $v=1 ; t \neq v$, because $z \neq x$), then, consequently, $t=2$.

Now, adding twice the first equation to the third equation (*), we get $4 z+4 x+6=4 x+2 z+3 u$, i.e., $z=\frac{3}{2} u-3$. Substituting $t=2, z=\frac{3}{2} u-3$ into the equation (***), we get:

$$
(4 s-13) u+2 s^{2}+22=0
$$

From this, it is clear that $4 s-13 < 0$, and $s \neq 1, s \neq 2$, so obviously $s=3$. Substituting all these values into the equations (*), we get a system of three linear equations with three unknowns:

$$
\begin{array}{r}
x+z+u=2 x+1 \\
2 x+u=4 z+4 \\
2 x+z=6 u+9
\end{array}
$$

from which we easily find $x(=y)=96, z=57, u=40$.

$3^{\circ}$. Among the numbers $x, y, z, u$, there are two pairs that are pairwise equal. Let, for example, $x=y, z=u$. In this case, the first equation (") gives $x=2 z-1$; substituting this result into the equation ( $\left(^{**}\right.$ ):

$$
x=(2 t-3) z+t^{2}+1
$$

we get:

$$
(2 t-5) z+t^{2}+2=0
$$

From this, it follows that $2 t-5 < 0$, and $t \neq 1$, so $t=2$. Now the equations ( ${ }^{*}$ ) take the form

$$
\begin{aligned}
& x+2 z=2 x+1 \\
& 2 x+z=4 z+4
\end{aligned}
$$

from which $x(=y)=11, z(=u)=6$.

$4^{\circ}$. Three of the numbers $x, y, z, u$ are equal to each other. Here, too, we need to consider two sub-cases separately.

A) $y=z=u$. In this case, the equation (***) and the first equation (*) take the form

$$
x=3(2 w-3) y+3 w^{2}+1 ; \quad 2 x=3 y-1
$$

and, obviously, are inconsistent.

B) $x=y=z$. The first equation (*) gives in the considered case

$$
2 x+u=2 x+1
$$

from which $u=1$; the last equation (*) gives

$$
3 x=2 s u+s^{2}=2 s+s^{2} ; x=\frac{s(s+2)}{3} .
$$

But $x$ is an integer; therefore, either $s$ or $s+2$ must be divisible by 3, i.e., $s=3 k, x=k(3 k+2)$, or $s=3 k-2, x=(3 k-2) k$; here $k$ is an arbitrary integer.

$5^{\circ}$. All numbers $x, y, z, u$ are equal to each other. In this case, the first equation ( ${ }^{*}$ ) immediately gives $3 x=2 x+1, x=1$.

Thus, we obtain the following solutions to the problem:

$$
\begin{gathered}
x=y=96, z=57, u=40 ; x=y=11, z=u=6 \\
x=y=z=k(3 k \pm 2), u=1 ; x=y=z=u=1
\end{gathered}
$$

(the case $k=1$ and the minus sign in the preceding formulas).