When can a sum of 3 identical squares be written as a sum of 3 non-identical squares? Consider $3n^2$ for some positive integer $n$. When do there exist positive integers $n_1,n_2,n_3$, not all equal to $n$, such that
$$
3n^2 = n_1^2 + n_2^2 + n_3^2
$$
An example is $27$:
$$
27 = 3^2 + 3^2 + 3^2 = 1^2 + 1^2 + 5^2
$$
 A: I have one hint:
$(n-\alpha)^2 + (n- \alpha)^2 + (n+\alpha)^2 = n^2 -2n\alpha + \alpha^2 + n^2 -2n\alpha + \alpha^2 + n^2 +2n\alpha + \alpha^2 = \\ n^2 + n^2 + n^2 + 3\alpha^2 - 2n\alpha.$
So, if we want for the sum to have $3n^2$, then it is mandatory that we have $3\alpha^2-2n\alpha =0 \iff 3\alpha = 2n$, i.e. $\alpha = \frac{2n}{3}$.
Finally, the hint will work in a case when $n$ is divisible by $3$.
A: I know this is more than your question asks (my high-school calculus teacher would kill me for answering more than the question asked!), but…
Using well-known parameterizations for the 2.3.3 equation (cf. Bradley, etc.), here’s a complete formula in integers $r,s,t,u,v$:
\begin{align}
  n &= \frac{(r^2+s^2+t^2)(rv-su)}{r^2+s^2-(r+s)t}  \\[0.5em]
  n_1 &= \frac{(t^2-2rt+s^2-2rs-r^2)(rv-su)}{r^2+s^2-(r+s)t}  \\[0.5em]
  n_2 &= \frac{(t^2-2st-s^2-2rs+r^2)(rv-su)}{r^2+s^2-(r+s)t}  \\[0.5em]
  n_3 &= \frac{(-t^2-2st+s^2-2rt+r^2)(rv-su)}{r^2+s^2-(r+s)t}.
\end{align}
For example, $(r,s,t,u,v)=(1,-2,4,12,7)$ yields the equation (after clearing denominators)
$$3(217)^2 = 31^2+155^2+341^2.$$
If you want a primitive example, just make sure $rv-su=1$. For example, $(r,s,t,u,v)=(2,3,11,3,5)$ leads to the equation
$$3(67)^2=19^2+35^2+109^2.$$
Hope this helps!
