TITLE: Is there a slick way to test whether $\Bbb Z_{mn}\cong \Bbb Z_m\oplus \Bbb Z_n$?
QUESTION [5 upvotes]: I'm quite new to group theory, so apologies if this is a silly question to ask: it just interested me that 
$$\require{cancel}\Bbb Z_{4}\ncong\Bbb Z_2\oplus \Bbb Z_2$$
whereas
$$\Bbb Z_{6}\cong \Bbb Z_2\oplus \Bbb Z_3$$
For the first non-equation (I don't know the correct terminology to use here), since $\Bbb Z_2$ is a cyclic group of order $2$ it follows that each element in $\Bbb Z_2\oplus \Bbb Z_2$ has at most order $2$ and thus the isomorphism is impossible. But for the second equation, I cannot tell whether it's true at glance. I only know that the orders of elements in both LHS and RHS are $1,2,3,6$. I do not know whether RHS is cyclic till I write it explicitly, which is quite inefficient. 
So I am wondering if there is a better way to handle this kind of problem in general: is there a know-it-at-first-glance method to tell whether 
$$\Bbb Z_{mn}\cong \Bbb Z_{m}\oplus \Bbb Z_{n}?$$
Or even more generally, what about 
$$\Bbb Z_{m_1m_2\cdots m_n}\cong \Bbb Z_{m_1}\oplus \Bbb Z_{m_2}\oplus\cdots\oplus\Bbb Z_{m_n}?$$

REPLY [3 votes]: Consider the mapping
$$
\varphi\colon\mathbb{Z}\to\mathbb{Z}_m\oplus\mathbb{Z}_n
$$
defined by
$$
\varphi\colon x\mapsto (x+m\mathbb{Z},x+n\mathbb{Z})
$$
which is a group homomorphism.
Its kernel is
$$
\ker\varphi=\{x\in\mathbb{Z}:x\in m\mathbb{Z}, x\in n\mathbb{Z}\}
=m\mathbb{Z}\cap n\mathbb{Z}=k\mathbb{Z}
$$
where $k$ is the lowest common multiple of $m$ and $n$.
Thus $\varphi$ induces an injective homomorphism
$$
\tilde\varphi\colon \mathbb{Z}/\ker\varphi=\mathbb{Z}_k
\to\mathbb{Z}_m\oplus\mathbb{Z}_n
$$
which is surjective if and only if $k=mn$, by looking at the number of elements in the domain and codomain, that is, $\gcd(m,n)=1$.
Conversely, it's easy to see that $\mathbb{Z}_m\oplus\mathbb{Z}_n$ is not cyclic if $\gcd(m,n)>1$, so it can't be isomorphic to $\mathbb{Z}_{mn}$.
Generalize to any (finite) number of factors.

REPLY [3 votes]: Note that $\Bbb Z_m\oplus \Bbb Z_n$ has order $mn$ and exponent $lcm(m,n)$ (that is, every element has order at most $lcm(m,n)$).
Therefore, $\Bbb Z_m\oplus \Bbb Z_n$ cannot be cyclic unless $lcm(m,n)=mn$, and this is equivalent to $gcd(m,n)=1$.
Thus, if $gcd(m,n)>1$, then $\Bbb Z_{mn}\not\cong \Bbb Z_m\oplus \Bbb Z_n$.
The converse is also true, and is the subject of the Chinese Remainder Theorem.