# $G=C_{p}\times C_{p^2}$, describe $\mathrm{End}(G)$

I was asked to describe the group of the endomorphism of $G=C_{p} \times C_{p^2}$, with p prime ($C_n$ is the cyclic group of order $n$).

I started setting (g,1) and (1,h) as generators of the subgroups $(C_{p},1)$ and $(1,C_{p^2})$ so every endomorphism $\varphi$ is determined by it's value on these elements. $$\varphi((g,1))=g^ah^b$$ $$\varphi((1,g))=g^ch^d$$ so I count $p*p^2*p*p^2$ different results and so there are $p^6$ different endomorphisms. Is this correct? How can I say something about the algebraic structure of $\mathrm{End}(G)$?

This is the first exercise of this type I have to deal with, so I don't know the general strategies to solve it efficiently. Can someone please explain me how to work with endomorphism groups in this specific case (or in the slightly generalization of $C_n\times C_m$ with $n,m \in \mathbb{N}$)?

There is a restriction: the element $g$ can only be mapped onto an element of period a divisor of $p$. There are $p^{2}$ of these in $G$. The element $h$ must be mapped onto an element of period a divisor of $p^{2}$, but all elements of $G$ satisfy this. So the total number of endomorphisms is $p^{2} \cdot p^{3} = p^{5}$.
Explicitly, an endomorphism $\varphi$ maps $$g \mapsto g^{a} h^{p b}, \qquad h \mapsto g^{c} h^{d},$$ where $0 \le d < p^{2}$ and $0 \le a, b, c < p$.
In the general case, again you have only to make sure that you are mapping an generator of order $k$ onto an element of order dividing $k$.