<s>[INST] Which integers are the areas of squares with vertices in the 3d integer lattice? For which integers $n$ does there exist a square of area $n$ with vertices in the 3d integer lattice $\mathbb{Z}^3$? 
A sufficient condition is that $n$ is a square or the sum of two squares, and I have verified that the condition is also necessary when $n < 10^5$.
Edit: This question was posed by James Tanton on Twitter. I thought it was very interesting, so I took the liberty of posting it here.
Edit 2: I have extended the search to $n < 10^6$ without finding any counterexamples.
 [/INST] Translate one of the vertices to the origin, then the two adjacent vertices of the square are $(x,y,z)$ and $(u,v,w)$ where $x^2 + y^2 + z^2 = u^2 + v^2 + w^2 = s$ and $xu + yv + zw = 0$, and the area of the square is $s$.  Now consider
$$
\begin{align}
(xw-uz)^2 + (yw-vz)^2
&=x^2w^2 - 2xwuz + u^2z^2 + y^2w^2 - 2ywvz + v^2z^2\\
&=(x^2 + y^2)w^2 + (u^2 +v^2)z^2 - 2(xu+yv)wz\\
&=(x^2 + y^2)w^2 + (u^2 +v^2)z^2 + 2(zw)wz\\
&=(x^2 + y^2 + z^2)w^2 + (u^2 +v^2+w^2)z^2\\
&=s(w^2+z^2)
\end{align}
$$
Since a number is a sum of two squares if and only if each prime factor of that number that is equal to $3\pmod{4}$ occurs with even exponent, all prime factors of $(xw-uz)^2 + (yw-vz)^2$ and $w^2+z^2$ equal to $3\pmod{4}$ occur with even exponent, thus each prime factor of $s$ equal to $3\pmod{4}$ must also occur with even exponent. Therefore, $s$ is a sum of two squares.
</s>