Cyclic group of direct product

I know that $Z_m \times Z_n$ is cyclic and isomorphic to $Z_{mn}$ if and only if $\gcd(m,n)=1$. There is also a corollary that saying "The group $Z_{m_1} \times Z_{m_2} \times Z_{m_3} \times \ldots \times Z_{m_i}$ is cyclic and isomorphic to $Z_{m_1 m_2 \ldots m_i}$ if and only if any two of $m_i$'s are relatively prime. Why is that so? Shouldn't all of them be relatively prime? For example, according to this corollary,$Z_4 \times Z_3 \times Z_{10}$ must be isomorphic to $Z_{120}$, but it is not. So, what is the correct version of this corollary?

Thank you

• It seems that the conditions "any two of mi's are relatively prime" and "all of them are relatively prime" are equvivalent. – Alex Ravsky Apr 13 '13 at 19:52
• The $m_i$'s must be pairwise coprime – user63181 Apr 13 '13 at 19:55
• oh, so i understood the sentence wrong, right? It is saying that if we take any two of them, then these must be relatively prime, and so all of them are relatively prime – Yasin Razlık Apr 13 '13 at 19:57

In your "counter"-example it is not true that any two of $m_i$'s are relatively prime, because $\gcd(4,10)\ne 1$, and indeed $\Bbb Z_4\times\Bbb Z_3\times \Bbb Z_{10}\ncong\Bbb Z_{120}$, so it is all correct.
• Yes, any two of them: so they are "pairwise coprime", which is a stronger condition (as the example shows) than "all of them" has greatest common divisor $1$. – Berci Apr 13 '13 at 20:19