Problem: Find all functions $f \colon \ZZ \to \ZZ$ such that,
for all integers $a$, $b$, $c$ that satisfy $a+b+c=0$,
the following equality holds:
\[ f(a)^2+f(b)^2+f(c)^2 = 2f(a)f(b)+2f(b)f(c)+2f(c)f(a). \]

Solution: Answer: for arbitrary $k \in \ZZ$, we have
\begin{enumerate}[(i)]
  \ii $f(x) = kx^2$,
  \ii $f(x) = 0$ for even $x$, and $f(x) = k$ for odd $x$, and
  \ii $f(x) = 0$ for $x \equiv 0 \pmod 4$,
  $f(x) = k$ for odd $x$, and $f(x) = 4k$ for $x \equiv 2 \pmod 4$.
\end{enumerate}
These can be painfully seen to work.
(It's more natural to think of these as
$f(x) = x^2$, $f(x) = x^2 \pmod 4$, $f(x) = x^2 \pmod 8$,
and multiples thereof.)

Set $a=b=c=0$ to get $f(0)=0$.
Then set $c=0$ to get $f(a) = f(-a)$, so $f$ is even.
Now \[ f(a)^2 + f(b)^2 + f(a+b)^2
= 2f(a+b)\left( f(a)+f(b) \right) + 2f(a)f(b) \]
or
\[ \left( f(a+b) - \left( f(a)+f(b) \right) \right)^2
  = 4f(a)f(b). \]
Hence $f(a)f(b)$ is a perfect square for all $a,b \in \ZZ$.
So there exists a $\lambda$ such that $f(n) = \lambda g(n)^2$, where $g(n) \ge 0$.
From here we recover
\[ \boxed{g(a+b) = \pm g(a) \pm g(b)}. \]
Also $g(0) = 0$.

Let $k = g(1) \neq 0$.
We now split into cases on $g(2)$:
\begin{itemize}
  \ii $g(2) = 0$. Put $b = 2$ in original to get
  $g(a+2) = \pm g(a) = +g(a)$.
  \ii $g(2) = 2k$. Cases on $g(4)$:
  \begin{itemize}
    \ii $g(4) = 0$, then we get
    $(g(n))_{n\ge0} = (0,1,2,1,0,1,2,1,\dots)$.  This works.
    \ii $g(4) = 4k$. This only happens when
    $g(1) = k$, $g(2) = 2k$, $g(3) = 3k$, $g(4) = 4k$.
    Then
    \begin{itemize}
      \ii $g(5) = \pm 3k \pm 2k = \pm 4k \pm k$.
      \ii $g(6) = \pm4k \pm 2k = \pm5k \pm k$.
      \ii \dots
    \end{itemize}
    and so by induction $g(n) = nk$.
  \end{itemize}
\end{itemize}