The magic words are "Smith Normal Form". The magic references is "Integral Matrices" by M. Newman, which discusses many questions of this sort in a lucid way.
Igor Rivin
- 96.4k
- 11
- 153
- 366