Solution (source code)

= Solution

The Chinese remainder isomorphism $\mathbb Z/(nm)\cong\mathbb Z/n\times\mathbb Z/m$ restricts to a bijection on units. Counting those units gives $\phi(nm)=\phi(n)\phi(m)$.