Let $n,m \in \mathbb{N}$, prove that $\mathbb{Z_m} \times \mathbb{Z}_n \cong \mathbb{Z}_d \times \mathbb{Z}_l $ where, $d=gcd(m,n)$ and $l=lcm(m,n)$.
At first I tried to define a homomorphism $\varphi: \mathbb{Z} \times \mathbb{Z} \rightarrow \mathbb{Z}_d \times \mathbb{Z}_l $ in the natural way, and prove that $ker(\varphi)=(m)\times(n)$, but I did not see the way.
So I try using elemental divisors as follows:
Since $gcd(m,n)\cdot lcm(m,n)=mn$, we know that
$$|\mathbb{Z_m} \times \mathbb{Z}_n| =mn=dl=| \mathbb{Z}_d \times \mathbb{Z}_l| $$
Lets write $n$ and $m$ in their "complete prime factorization" (Using all the primes "in" $n$ and $m$ with powers zero if the prime do not appear in the factorization)
$n=p_1^{\alpha_1}\cdots p_k ^{\alpha_k}$ and $m=p_1^{\beta_1}\cdots p_k ^{\beta_k}$, with $\alpha_i,\beta_i\geq0$, $p_i$ prime, then $mn=p_1^{\alpha_1+\beta_1}\cdots p_k ^{\alpha_k+\beta_k}$.
If this is the case then, $d=p_1^{\delta_1}\cdots p_k^{\delta_k}$ and $l=p_1^{\sigma_1}\cdots p_k^{\sigma_k}$, where $\delta_i=min\{\alpha_i,\beta_i\}$ and $\sigma_i=max\{\alpha_i,\beta_i\}$.
And as $dl=mn$ then, $\alpha_i+\beta_i=\delta_i+\sigma_i$, for all $i=1,\cdots k$.
Therefore,
$$ \mathbb{Z_n} \cong \mathbb{Z}_{p_1^{\alpha_1}} \times \cdots \times \mathbb{Z}_{p_k^{\alpha_k}}\;, \mathbb{Z_m} \cong \mathbb{Z}_{p_1^{\beta_1}} \times \cdots \times \mathbb{Z}_{p_k^{\beta_k}}$$ and
$$\mathbb{Z_d} \cong \mathbb{Z}_{p_1^{\delta_1}} \times \cdots \times \mathbb{Z}_{p_k^{\delta_k}}\; , \mathbb{Z_l} \cong \mathbb{Z}_{p_1^{\sigma_1}} \times \cdots \times \mathbb{Z}_{p_k^{\sigma_k}}$$
Finally, without loss of generality, if $\delta_i=\alpha_i$ for some $i \in \{1,\cdots,k\}$, then $\sigma_i=\beta_i$, so $\mathbb{Z_m} \times \mathbb{Z}_n$ and $\mathbb{Z}_d \times \mathbb{Z}_l $ has the same elemental divisors, then they are isomorphic.
The proof is ok? and if it is, how can I improve it if is the case