How many subspaces of $ \mathbb{Z}_p^3$ To do this I started considering $3 \times 3$ matrices in row echelon form, with their entries in  $\mathbb{Z}_p$. In row echelon form, the span of the non-zero rows creates a subspace, so I condiser echelon forms with $0,1$ and $2$ non-zero rows, which will generate the corresponding dimensional subgroups (with the trivial case being 3).
I can easily count the number of different echelon forms of these types, but I don't know how to take into account that some of these will generate the same subgroup. For each dimension k, I need to divide by something, but I can't figure out what this something is that will mean I don't get rows which span the same subspace. Can anyone help?
 A: Sketch:


*

*There is a zero-dimensional subspace $\{0\}$.  There is only subspace of this dimension.

*For one-dimensional subspaces, each element $(a_1,a_2,a_3)$ generates a subspace with $p$ elements and each nonzero element generates the same subspace.  Therefore, there are $(p^3-1)/(p-1)=p^2+p+1$ subspaces of this type.

*For two-dimensional subspaces, each subspace is perpendicular to a one-dimensional subspace.  This means that there are the same number of one-dimensional and two-dimensional subspaces $(p^2+p+1)$.  

*There is only one three-dimensional subspace, $(\mathbb{Z}/p)^3$ itself.
Alternately, we can generate a two-dimensional subspace with two nonzero generators.  The first nonzero generator can be any element (so there are $p^3-1$ choices) and the second cannot be in the same line as the first (so there are $p^3-p$ choices for the second generator).  This leads to $(p^3-1)(p^3-p)$ possible generator pairs.  
However, some of these give the same two dimensional space.  Each of these are isomorphic to $(\mathbb{Z}/p)^2$, so we need to know how many generating pairs there are this space.  The first generator can be any nonzero element (so there are $p^2-1$ choices for this) and the second cannot be in the same line as the first (so there are $(p^2-p)$ choices for this element).
Combining all of this, the number of subspaces is
$$
\frac{(p^3-1)(p^3-p)}{(p^2-1)(p^2-p)}=\frac{(p-1)(p^2+p+1)p(p-1)(p+1)}{(p-1)(p+1)p(p-1)}=p^2+p+1
$$
