Solution (source code)

= Solution

If $m$ and $n$ are <coprime integers>[coprime], every divisor of $mn$ is uniquely $ab$ with $a\mid m$ and $b\mid n$. Hence, for a <multiplicative arithmetic function> $f$,
$$
g(mn)=\sum_{a\mid m}\sum_{b\mid n}f(ab)
=\left(\sum_{a\mid m}f(a)\right)
 \left(\sum_{b\mid n}f(b)\right)=g(m)g(n).
$$

The <Möbius function> is $\mu(n)=0$ if a prime square divides $n$, and $\mu(n)=(-1)^r$ if $n$ is a product of $r$ distinct primes. The <Euler totient function> $\phi(n)$ counts residues modulo $n$ coprime to $n$. From the prime factorizations,
$$
\frac{\phi(n)}n=\prod_{p\mid n}\left(1-\frac1p\right)
=\sum_{d\mid n}\frac{\mu(d)}d.
$$
Both sides of the second identity are multiplicative, and at a prime power $p^a$,
$$
\sum_{d\mid p^a}\frac{\mu(d)^2}{\phi(d)}
=1+\frac1{p-1}=\frac p{p-1}
=\frac{p^a}{\phi(p^a)}.
$$
Therefore
$$
\boxed{\frac{n}{\phi(n)}=
\sum_{d\mid n}\frac{\mu(d)^2}{\phi(d)}}.
$$