# Express $355$ as a sum of three squares.

PROBLEM

Find all the ways to express $355$ as a sum of three squares.

MY ATTEMPT

By Legendre's three-square theorem, since $355$ is not of the form $n = {4^a}(8b+7)$ (for $a, b \in \mathbb{Z}$), then $355$ can be expressed as a sum of three squares.

WLOG, we can restrict to positive integral solutions in $$x^2 + y^2 + z^2 = 355,$$ where $x \leq y \leq z$.

WolframAlpha gives $$x = 7, y = 9, z = 15,$$ and $$x = 3, y = 11, z = 15.$$

QUESTION

Are these all of the solutions?

I do not consider any order between $x,y,z$ here.

$x^2+y^2+z^2\equiv 1\pmod 3$ and since $(0,1,2)\xrightarrow{x^2}(0,1,1)$ then we can only be in the $0+0+1$ configuration, so two numbers are divisible by $3$.

$x=3a,\ y=3b$ gives $9(a^2+b^2)+z^2=355\iff z^2\equiv 4\pmod 9\iff z\equiv 2,7\pmod 9$

Since $19^2=361>355$ then only $z=2,7,11,16$ are possible.

For $a^2,b^2$ we are limited to values $0,1,4,9,16,25,36$ in the table below and it is easy to find them manually

$\begin{array}{|c|c|c|c|}\hline z & \frac{355-z^2}9 & a^2+b^2 & x,y\\\hline 2 & 39 & \varnothing \\ 7 & 34 & 9+25 & 9,15\\ 11 & 26 & 1+25 & 3,15\\ 16 & 11 & \varnothing \\\hline \end{array}$

Yes, that is all. It is a quick check in a spreadsheet. We know $0 \le x \le 10$ and $11 \le z \le 18$, so put $0-10$ in a column, $11-18$ in a row and sqrt(355-left^2-up^2) in each cell. Scan for integers and you find the solutions. Mixed references and copy down/copy right mean you just type the formula once.