Let $m_1$, $m_2$, $\ldots$, $m_n$ be positive integers, and let $Z_{m_i}$ denote the group $\{0, 1, 2, \ldots, m_{i}-1\}$ under addition modulo $m_i$, for each $i = 1,2, \ldots, n$.
Then what is the necessary and sufficient condition for the Cartesian product $\Pi_{i=1}^n Z_{m_i}$ to be cyclic?
Hint: $\mathbb{Z}_n\times\mathbb{Z}_m\cong\mathbb{Z}_{mn}$ if and only if $m$ and $n$ share no prime factors.