Find all functions $f:\mathbb N_0\to \mathbb N_0$ such that $f(a^2+b^2)=f(a)^2+f(b)^2$ I think the answer is that there are only 2 such functions: the zero function and the identity function, but I'm not able to prove it.
A few findings:

*

*$f(0)=0$ and thus $f(a^2)=f(a)^2$.


*If $f(1)=0$, then $f(2^n)=0$ for all $n\in \mathbb N_0$; if $f(1)=1$, then $f(2^n)=2^n$ for all $n\in \mathcal N_0$ (can be proven by PMI).


*For any functions satisfying the condition, say $f,g$, $f\circ g$ also satisfies the condition.
Source of this problem: https://www2.math.binghamton.edu/p/pow/problem2f20
 A: I found a much simpler proof, heavily based on and inspired by the ideas of Hagen von Eitzen's solution. For the sake of completeness, we first note that $f(0) = 2f(0)^2$ and because $1 \neq 2f(0)$, we must have $f(0) = 0$. Next we find $f(1)^2 = f(1)$ and so $f(1) \in \{ 0,1 \}$. For convenience, denote $u = f(1)$. More generally, we have that $f(a^2) = f(a)^2$.
We proceed by noting that $f(2) = 2u^2 = 2u$ and so $f(4) = f(2)^2 = 4u$. Further, observe that $f(5) = f(1)^2 + f(2)^2 = 5u$. Next we note that
$f(3)^2 + f(4)^2 = f(25) = f(5)^2.$ We conclude that $f(3) = 3u$ also. Lastly, we note that $f(8) = f(2)^2 + f(2)^2 = 8u$ and $f(10) = f(3)^2 + f(1)^2 = 10u,$ so that from
$f(6)^2 + f(8)^2 = f(100) = f(10)^2$ we find that $f(6) = 6u$ too.
We will now prove with induction that $f(n) = nu$ for all non-negative integers $n$. Suppose that for some integer $n > 6$ we have shown that $f(k) = ku$ for all $k < n$. If $n$ is odd, write $n = 2m+1$ for some $m > 2$. Then the equality
$$
(2m+1)^2 + (m-2)^2 = (2m-1)^2 + (m+2)^2
$$
implies via the functional equation that
$$
f(2m+1)^2 + f(m-2)^2 = f(2m-1)^2 + f(m+2)^2
$$
Since all of $m-2$, $2m-1$ and $m+2$ are smaller than $2m+1$, the result for $n = 2m+1$ follows by induction. Similarly, for even $n$, we write $n = 2m+2$ for some $m > 2$ to find that
$$
(2m+2)^2 + (m-4)^2 = (2m-2)^2 + (m+4)^2
$$
implies via the functional equation that
$$
f(2m+2)^2 + f(|m-4|)^2 = f(2m-2)^2 + f(m+4)^2.
$$
Therefore the induction hypothesis ensures that the result also holds for $n = 2m+2$, as desired.
A: With $u=f(1)$, let
$$ S=\{\,n\in\Bbb N_0\mid f(n)=nu\,\}.$$
Clearly,

*

*$0\in S$,

*$1\in S$,

*If two of $a,b,a^2+b^2$ are $\in S$, then so is the third

*If one of $a,2a^2$ is $\in S$, then so is the other

*If $a^2+b^2=c^2+d^2$ and three of $a,b,c,d$ are $\in S$, then so is the fourth

From these, we conclude by induction (as you already did), $2^n\in S$ for all $n$, but we also have for example $5=2^2+1^2\in S$ and then from $3^2+4^2=0^2+5^2$, we get $3\in S$ and also $9=3^2\in S$.
We also have $7\in S$ from $7^2+1^2=2\cdot 5^2$.
Also, $10=3^2+1^2\in S$. Thus the last bullit point applied to $6,8,10,0$ gives us $6\in S$.
Assume $S\ne\Bbb N_0$ and let $a=\min(\Bbb N_0\setminus S)$. From the results so far, we know $a\ge 11$.
Lemma 1. Let $k$ be odd and assume $a\ge M$, where $$M\ge\frac{9k^2+4k}8.$$ Then $2a-k$ is prime.
Proof. Assume $2a-k=rs$ with $1<r\le s$. Then $r,s$ are odd and hence $r\ge 3$ and
$$s\ge \sqrt{2M-k}\ge\frac32k.$$
We have
$$a^2-(a-k)^2=kr\cdot s=\left(\frac{kr+s}2\right)^2- \left(\frac{|kr-s|}2\right)^2,$$
where $a-k$, $\frac{kr+s}2$, $\frac{|kr-s|}2$ are natural numbers. To see that they are all $<a$, note that
$$\frac{kr+s}2=\frac{2a-k}2\left(\frac ks+\frac 1r\right) \le
\frac{2a-k}2\left(\frac23+\frac13\right)<a. $$
Thus by  minimality of $a$, we conclude   $a-k, \frac{kr+s}2, \frac{|kr-s|}2\in S$, and then by the last bullit  point above, we conclude $a\in S$, contradiction. $\square$
Corollary. $a\le 24$.
Proof. Otherwise, apply the lemma with $k=1,3,5$ and $M=25$ to find three consecutive primes $2a-5,2a-3,2a-1$ (and they are not $3,5,7$). $\square$
By the same method with $M=11$, we see that $2a-3, 2a-1$ are twin primes. Together with the special cases we have already found above, the only remaining possibility is $a=22$.
Using
$$ 22^2+4^2=20^2+10^2$$
we finally eliminate this case as well.
But if there is no possible value for $a=\min(\Bbb N_0\setminus S)$, it must be the case that $S=\Bbb N_0$.
