# Number of Homomorphisms from $\Bbb{Z}_m$ to $\Bbb{Z}_n$

This question coutesy of Allan Clark's "Elements of Abstract Algebra" (60$\zeta$).

Find the number of homomorphisms from $\Bbb{Z}_m\to \Bbb{Z}_n$ as a function of $m$ and $n$.

This is stumping me, can anyone help?

-

In general, if $G$ is any group, then you can show that the number of homomorphisms $\mathbb{Z}_m \rightarrow G$ is the number of solutions to $x^m = 1$ in $G$. How many solutions are there to $x^m = 1$ in $\mathbb{Z}_n$?
Also we can say that number of homomorphism $\mathbb Z_m \rightarrow G$ is the number of solution to mx = 0 in G –  user120386 Mar 5 at 16:08
HINT: If $h:\Bbb Z_m\to\Bbb Z_n$ is a homomorphism, $\big|h[\Bbb Z_m]\big|\cdot|\ker h|=m$, and $\big|h[\Bbb Z_m]\big|$ divides $n$.