Given a ring $R$, let $\text{GL}(n, R)$ be the group of invertible $n \times n$ matrices with entries in $R$. I know the easy counting argument that shows that $\text{GL}(n, \mathbb{F}_q)$ has $(q^n - 1)(q^n - q) \cdots (q^n - q^{n-1})$ elements, where $\mathbb{F}_q$ is a finite field with $q$ elements.
However, I have no idea how to find a formula for the cardinality of $\text{GL}(n, \mathbb{Z}/m\mathbb{Z})$ for a positive integer $m$. Can somebody give me an hint or even a reference? Thanks!
Here's just a hint (I don't actually know the solution, and have no time to hunt it down, but this is the direction I would take). One needs to count the "bases" of $(\Bbb Z/m\Bbb Z)^n$, subsets for which every element is uniquely a $\Bbb Z/m\Bbb Z$-linear combination.
The fundamental problem is to count the number of elements of $(\Bbb Z/m\Bbb Z)^n$ that span a subgroup of order$~m$ that is a direct factor of the whole group. That depends on some arithmetic property; I think that maybe it is sufficient just to have order$~m$ to be a direct factor (this happens if the $\gcd$ of all coordinates and $m$ together is$~1$). Once this is done, you can quotient by the subgroup and solve the problem of choosing a basis for the quotient recursively. Coming back from the recursion, don't forget that all basis elements for the quotient can independently be lifted to $m$ different representatives in the original group, and that all these give different bases for the original problem (so you get a power of $m$ in the result).