How to find the number of homomorphisms of $\mathbb{Z}$ into $\mathbb{Z}$? Consider the maps $\mu:\mathbb{Z}→\mathbb{Z}$ and  $\mu:\mathbb{Z}→\mathbb{Z}_2$. For example if I am asked to find the number of homomorphisms of $\mathbb{Z}$ into $\mathbb{Z}$, and of $\mathbb{Z}$ onto $\mathbb{Z}_2$, what do I  have to do? I don't have idea here. Thanks.
 A: A group homomorphism $f:\mathbb{Z}\to R$ from $\mathbb{Z}$ to any commutative ring $R$ is determined by the image of $1$ since $f(n)=n f(1)$. If $f$ is required to be a ring homomorphism, we know $f(1)=1$, so there is only one homomorphism at all. This property means that $\mathbb{Z}$ is the "initial object" in the category of rings.
A: This question isn't very well-posed, but luckily there's a general answer to your question. The following identities are easily verified
1) $$\text{Hom}(\mathbb{Z},\mathbb{Z})\cong\mathbb{Z}$$
2) When $n\geqslant2$ $$\text{Hom}(\mathbb{Z},\mathbb{Z}_n)\cong\mathbb{Z}_n$$
3) When $n\geqslant 2$ $$\text{Hom}(\mathbb{Z}_n,\mathbb{Z})\cong0$$
4) When $n,m\geqslant2$  $$\text{Hom}(\mathbb{Z}_n,\mathbb{Z}_m)\cong\mathbb{Z}_{(n,m)}$$
With this all in mind, and using the fact that $\text{Hom}$ and $\oplus$ (for finitely many groups) commute in both variables one can deduce that
$$\text{Hom}\left(\mathbb{Z}^r\times\mathbb{Z}_{\ell_1}\times\cdots\times\mathbb{Z}_{\ell_n},\mathbb{Z}^s\times\mathbb{Z}_{k_1}\times\cdots\times\mathbb{Z}_{k_m}\right)\cong\mathbb{Z}^{rs}\times\prod_{j=1}^{m}\mathbb{Z}_{k_j}^m\times\prod_{i=1}^{n}\prod_{j=1}^m\mathbb{Z}_{(\ell_i,k_j)}$$
Of course, this gives you a theoretical way to find the Hom group between any two finitely generated abelian groups, as well.
