Functions that link to divisor function I am interested in the following problem:

Do there exist a function $f:\mathbb{N}\to\mathbb{N}$ such that $$f(f(n))=\sigma_0(n)$$

My progress was the following (for sake of simplicity, we denote $\sigma_0(n)$ by $d(n)$):


*

*I proved $f(1)=1, f(2)=2$

*$f(d(n))=d(f(n))$

*$f$ is surjective

*$f(f(ab))=f(f(a))\cdot f(f(b))$ whenever $\gcd(a,b)=1$
However, I am not able to get any good idea to solve the main problem. Any help will be highly appreciated.
EDIT: To prove $f(2)=2,$ we note that $$f(f(2))=d(2)=2\implies f(f(f(2)))=f(2)\implies d(f(2))=f(2)$$Now we know that $d(N)=N\iff N=1,2$...Its easy to check that $f(2)\neq 1\implies f(2)=2$.
 A: A more intuitive solution
To construct the function $f$, we basically use the fact that there are infinitely many prime numbers. Its easy to see that $f(x)=1\iff x=1$ and $f(2)=2$ and so, now we further think how do we construct the function for higher entries.
Suppose we want to determine the value of $f(n)$ for some $n\geq 3$. To do so, we move inductively and assume that we have found out the value of $f(i)$ for all $i\leq n-1$. Okay, so we know the value of $f$ at $1$ and $2$ and thus, we can say $d(N)<N$ for all $n\geq 3$. This is actually a very beneficial statement because according to our inductive approach, we know the value of $f(d(n))$ and so, we know what is the value of $f(f(f(n)))$. But $f(f(f(n)))=d(f(n))$ and so, we know the value of $d(f(n))=k$ (say). Clearly, if we define $f(n):=p^{k-1}$, and $f(p^{k-1}):=d(n)$ then this satisfies all conditions where $p$ is some sufficiently large prime. Thus the functional square root of divisor function exists.
Example
We know $f(1)=1,f(2)=2$ and now, we find $f(3)$. As discussed earlier, we first find $d(3)$ which indeed is $2<3$. Thus, we know $f(2)=2=k$. Thus, $f(3)=p^{2-1}=p$ for some random large $p$. So, lets say $f(3)=5$ and thus, $f(5^{2-1})=f(5)=d(3)=2$. So till now, we defined:

*

*$f(1)=1$

*$f(2)=2$

*$f(3)=5$

*$f(5)=2$
Now, lets find $f(4)$. Applying the similar algorithm, we get $d(4)=3\implies f(3)=5=k$. Thus, $f(4)=p^{5-1}=p^4$. Lets take $p=7$ in this case. So, $f(7^{5-1})=d(4)=3$. So we get,

*

*$f(1)=1$

*$f(2)=2$

*$f(3)=5$

*$f(4)=2401$

*$f(5)=2$

*$f(2401)=3$
Now, we find $f(6)$ as we already know the value of $f$ for all $n\leq 5$. Going that way again, we note that $f(d(6))=f(4)=2401=k$. Thus, $f(6)=p^{2400}$. Lets take $p=23$ this time (we may also take $p=11$). Thus, $f(23^{2400})=d(6)=4$. So, we get,

*

*$f(1)=1$

*$f(2)=2$

*$f(3)=5$

*$f(4)=2401$

*$f(5)=2$

*$f(6)=23^{2400}$

*$f(2401)=3$

*$f(23^{2400})=4$
and we keep on continuing like that.
