Solution (source code)

= Solution

The <structure theorem for finitely generated modules over a principal ideal domain> applies because every <Euclidean domain> is a <principal ideal domain>. In invariant-factor form, every finitely generated <module> $M$ over such a domain $R$ has a decomposition
$$
\boxed{M\cong R^r\oplus R/(d_1)\oplus\cdots\oplus R/(d_s),\qquad d_1\mid d_2\mid\cdots\mid d_s,}
$$
where the $d_i$ are nonzero nonunits, $r\geq0$, and either list of summands may be empty. The free <rank> $r$ and the invariant factors $d_i$ are unique up to multiplication of each $d_i$ by a <unit>. Equivalently the torsion part is a direct sum of cyclic <modules> with prime-power annihilators. The nonunit convention omits zero summands $R/(1)$.