
A1. Determine all functions $f$ from the set of non-negative integers to itself such that

$$
f(a+b)=f(a)+f(b)+f(c)+f(d)
$$

whenever $a, b, c, d$, are non-negative integers satisfying $2 a b=c^{2}+d^{2}$.


Solution 1. (Ilya Bogdanov) The required functions are $f(n)=k n^{2}$, where $k$ is a non-negative integer - these clearly satisfy the condition in the statement.

Conversely, let $f$ be a function satisfying the condition in the statement. Setting $(a, b, c, d)=$ $(n, n, n, n)$ in the functional relation yields $f(2 n)=4 f(n)$ for all $n$. In particular, $f(0)=0$ and $f(2)=2 k$, where $k=f(1)$.

Setting successively $(a, b, c, d)=\left(n^{2}, 1, n, n\right),(a, b, c, d)=\left(n^{2}, 2,2 n, 0\right)$ and $(a, b, c, d)=$ $\left(n^{2}+1,1, n+1, n-1\right)$ in the functional relation yields

$$
\begin{aligned}
& f\left(n^{2}+1\right)=f\left(n^{2}\right)+k+2 f(n) \\
& f\left(n^{2}+2\right)=f\left(n^{2}\right)+4 k+f(2 n)=f\left(n^{2}\right)+4 k+4 f(n) \\
& f\left(n^{2}+2\right)=f\left(n^{2}+1\right)+k+f(n+1)+f(n-1)
\end{aligned}
$$

Subtraction of the second relation above from the sum of the other two yields $f(n+1)=$ $2 f(n)-f(n-1)+2 k$.

A straightforward induction on $n$ now shows that $f(n)=k n^{2}$ for all non-negative $n$, and completes the proof.
