[guided]We establish necessity in two stages: first the base case $a = 0$, which is a clean modular obstruction, then a descent argument that extends the obstruction to all $a \geq 0$.
**Stage 1: squares modulo 8.** The question "which residues modulo $8$ are squares?" has an explicit answer via the Chinese remainder-style enumeration: $x \bmod 4$ determines $x^2 \bmod 8$, and the four residue classes $0, 1, 2, 3$ produce $x^2 \equiv 0, 1, 4, 1$. So squares modulo $8$ land in $\{0, 1, 4\}$.
Now, which residues modulo $8$ are sums of three such squares? The set of sums $\{a + b + c : a, b, c \in \{0, 1, 4\}\}$, reduced modulo $8$, can be listed:
\begin{align*}
0+0+0 &= 0, & 0+0+1 &= 1, & 0+0+4 &= 4, \\
0+1+1 &= 2, & 0+1+4 &= 5, & 0+4+4 &= 8 \equiv 0, \\
1+1+1 &= 3, & 1+1+4 &= 6, & 1+4+4 &= 9 \equiv 1, \\
4+4+4 &= 12 &\equiv 4. & & &
\end{align*}
The set of achievable residues is $\{0, 1, 2, 3, 4, 5, 6\}$ — every residue **except** $7$. Hence no integer $n \equiv 7 \pmod 8$ is a sum of three squares.
**Stage 2: descent from $4n$ to $n$.** The key observation is: if $4n' = x_1^2 + x_2^2 + x_3^2$, then all $x_i$ are even. Why? Modulo $4$, we have $x_i^2 \in \{0, 1\}$ (squares modulo $4$ are $0$ or $1$, from $0^2, 1^2, 2^2, 3^2 \equiv 0, 1, 0, 1$). For $\sum x_i^2 \equiv 0 \pmod 4$, we need the $x_i^2 \bmod 4$ to sum to $0$ modulo $4$. Possible combinations: $(0,0,0)$, or $(1,1,1,1) \ldots$ but we have only three summands, so $(1, 1, 1) \equiv 3 \pmod 4 \neq 0$; $(1, 1, 0) \equiv 2 \pmod 4 \neq 0$; $(1, 0, 0) \equiv 1 \pmod 4 \neq 0$. Only $(0, 0, 0)$ works, meaning all $x_i$ are even.
Writing $x_i = 2 y_i$ and dividing by $4$: $n' = y_1^2 + y_2^2 + y_3^2$. So representability of $4 n'$ implies representability of $n'$. By induction, representability of $4^a m$ implies representability of $m$; contrapositively, if $m = 8b + 7$ is not representable (by Stage 1), then $4^a m$ is not representable.[/guided]