TITLE: Subgroups of a finite abelian group
QUESTION [27 upvotes]: Let $$G=\mathbb{Z}/p_1^{e_1}\times\cdots\times\mathbb{Z}/p_n^{e_n}$$  be any finite abelian group.
What are $G$'s subgroups? I can get many subgroups by grouping the factors and multiplying them by constants, for example: If $$G=\mathbb{Z}/3\times \mathbb{Z}/9\times \mathbb{Z}/4\times \mathbb{Z}/8,$$ then I can take $$H=3(\mathbb{Z}/3\times \mathbb{Z}/9)\times 2(\mathbb{Z}/4) \times \mathbb{Z}/8.$$ Do I get all subgroups that way? (I'm interested in all subgroups, not just up-to-isomorphism).
Which are the subgroups $H$ in $G$ for which $G/H$ is primary cyclic?

REPLY [6 votes]: It's worth noting this special case: if $G$ is isomorphic to $(\mathbb{Z}/p)^r$ then it can be regarded as a vector space of dimension $r$ over the field $\mathbb{Z}/p$, and the subgroups are just the subspaces.  The number of linearly independent lists of length $n$ is 
$(p^r-1)(p^r-p)\dotsb(p^r-p^{n-1})$ 
(choose a nonzero vector $v_1$, then a vector $v_2$ not in the one-dimensional space spanned by $v_1$, then $v_2$ not in the 2-dimensional space spanned by $v_1$ and $v_2$, and so on).  For any subspace $V$ of dimension $n$, the number of bases is 
$(p^n-1)(p^n-p)\dotsb(p^n-p^{n-1})$ 
by the same argument.  It follows that the number $N_n$ of subspaces of dimension $n$ is
$ N_n  =   \frac{(p^r-1)\dotsb(p^r-p^{n-1})}{(p^n-1)\dotsb(p^n-p^{n-1})} 
       =   \frac{(p^r-1)(p^{r-1}-1)\dotsb(p^{r-n+1}-1)}{(p^n-1)(p^{n-1}-1)\dotsb(p-1)}
$