A question on finite abelian groups Let $m_1,\dots,m_k$ be positive integers. Are there positive integers $d_1,\dots,d_k$ such that $d_i|d_{i+1}$ and 
$$
\oplus_{i=1}^k \mathbb{Z}/m_i\mathbb{Z}\cong
\oplus_{i=1}^k \mathbb{Z}/d_i\mathbb{Z}?
$$
I am aware of the fundamental theorem of finitely generated abelian groups. The question is whether the numbers of such $d_i$'s can always be the same as that of $m_i$'s. 
 A: Doesn't the first nontrivial case, with $k=2$, $m_1=2$, and $m_2=3$, give a counterexample? 
EDIT: User64726 has pointed out that this counterexample doesn't work if one allows $1$ to be among the $d_i$'s. Under that convention, the problem becomes whether we can always take the number of nontrivial $d$'s to be $\leq k$, where $k$ is the number of $m$'s; if we get fewer than $k$ $d$'s, then we can pad them by putting $1$'s at the beginning of the list of $d$'s.
On this understanding, the answer to the original question seems to be yes. Call a prime $p$ relevant if it divides at least one of the given $m_i$'s, and let $e(p,i)$ be the exponent of $p$ in the prime factorization of $m_i$.  So $\mathbb Z/m_i$ is the direct sum of the cyclic groups $\mathbb Z/(p^{e(p,i)})$.  So $G=\bigoplus_i(\mathbb Z/m_i)$ is the direct sum of cyclic groups of prime power order such that each prime $p$ occurs at most $k$ times, possibly with different exponents.  Now group all these summands together as follows. Take, for each relevant prime $p$, one copy of the highest-exponent $\mathbb Z/p^{e(p,i)}$ occurring in the decomposition of $G$.  The sum of these copies is $\mathbb Z/d_k$, where $d_k$ is the product of these factors $p^{e(p,i)}$, one factor for each $p$.  Next, among the summands of $G$ not incorporated in $\mathbb Z/d_k$, take, for each $p$, one copy of the highest-exponent $\mathbb Z/p^{e(p,i)}$ that remains, and use their direct sum as $\mathbb Z_{k-1}$.  Continue this way until, with $\mathbb Z/d_1$ or earlier, you've exhausted all the summands in $G$.  (It won't take longer than $k$ steps because each prime $p$ contributes at most $k$ summands in $G$, one summand from each $\mathbb Z/m_i$ for which $p$ divides $m_i$.) If you finish before $k$ steps, set the unused $d_i$'s equal to $1$.
