https://aops.com/community/p11414741
Supercali wrote:
The solutions are:
i)$f(n)=0 \ \forall n \in \mathbb{N}$
ii)$f(1)=1$ and $f(n)=0 \ \forall n >1$
iii)$f(n)=k^{v_p(n)}$ for some fixed $k \in \mathbb{N}$ and some fixed prime $p$
Proof:
From $f(m)=f(m)f(1)$ we get either $f$ is identically $0$ or $f(1)=1$. In the second case, if $f(p)=0$ for all primes $p$, we get the second solution. Else let $p$ be the smallest prime such that $f(p) \geq 1$. If $p>2$ then $f(2)=0$. But, $2|p-1$ implies $f(p-1)=0 \neq f(1)$. Hence $$f(p)=min \{f(p-1),f(1) \}=0$$Contradiction!!
Hence, $f(2) \geq 1$. For any other prime $q$, if $f(q)=0$ then $q|2^{q-1}-1$ implies $f(2^{q-1}-1)=0 \neq f(1)$. Hence $$f(2^{q-1})=min \{ f(2^{q-1}-1), f(1) \}= 0$$Contradiction!! Hence $f(q) \geq 1$ for all primes $q$.
If $f(p)=1$ for all primes $p$ then we get the solution $f(n)=1=1^{v_p(n)}$. Else, let $p$ be the smallest prime such that $f(p)=k>1$. For any other prime $q$, if $f(p^{q-1}-1) \neq 1$ then $$f(p^{q-1})=min \{ f(p^{q-1}-1), f(1) \} =1$$Contradiction!! Hence $f(p^{q-1}-1)=1$. Then, $q|p^{q-1}-1$ implies $$f(q)|f(p^{q-1}-1)=1$$Hence $f(q)=1$ for all other primes $q$. This gives the solution $f(n)=k^{v_p(n)}$.