Cyclicity Condition for Units of Ring of Integers Modulo m

Theorem
Let $n \in \Z_{\geq 0}$ be an integer.

Let $\left({\Z/n\Z,+,\cdot}\right)$ be the ring of integers modulo $n$.

Let $U = \left({ \left({ \Z/n\Z }\right)^\times,\cdot}\right)$ denote the group of units of this ring.

Then $U$ is cyclic if and only if $n = p^\alpha$ or $n = 2p^\alpha$, where $p \geq 3$ is prime and $\alpha \geq 0$.

Sufficient condition
Let $n \geq 0$ be an integer.

Let $n = p_1^{e_1} \cdots p_r^{e_r}$, be the decomposition of $n$ into distinct prime powers given by the Fundamental Theorem of Arithmetic.

Then by the Chinese remainder theorem we have an isomorphism:
 * $\Z/n\Z \simeq \Z/p_1\Z \times \cdots \times \Z/p_r\Z$.

By Units of Direct Product are Direct Product of Units we have:
 * $\left({\Z/n\Z}\right)^\times \simeq \left({\Z/p_1\Z}\right)^\times \times \cdots \times \left({\Z/p_r\Z}\right)^\times$.

Suppose that $r \geq 2$, and choose $i,j \in \left\{1,\ldots,r\right\}$, $i \neq j$.

If $\left({\Z/p_i\Z}\right)^\times$ or $\left({\Z/p_j\Z}\right)^\times$ is not cyclic, then $\left({\Z/n\Z}\right)^\times$ cannot be cyclic.

Therefore suppose that $\left({\Z/p_i\Z}\right)^\times$ and $\left({\Z/p_j\Z}\right)^\times$ are cyclic.

By Order of Group of Units of Integers Modulo m these groups have orders $\phi\left({ p_i^{e_i} }\right)$ and $\phi\left({ p_j^{e_j} }\right)$ respectively, where $\phi$ is the Euler $\phi$ function.

By Euler Phi Function of Integer we have:
 * $\phi\left({ p_i^{e_i} }\right) = p_i^{e_i - 1}\left({ p_i - 1 }\right)$

and
 * $\phi\left({ p_j^{e_j} }\right) = p_j^{e_j - 1}\left({ p_j - 1 }\right)$

If $p_i,p_j$ are odd, $2$ divides $p_i - 1$ and $p_j - 1$.

Therefore $2$ divides $\phi\left({ p_i^{e_i} }\right)$ and $\phi\left({ p_j^{e_j} }\right)$.

In particular $\phi\left({ p_i^{e_i} }\right)$ and $\phi\left({ p_j^{e_j} }\right)$ are not coprime.

Now by Group Direct Product of Cyclic Groups, $\left({\Z/n\Z}\right)^\times$ is not cyclic.

If $p_i$ or $p_j$ is even, without loss of generality we may as well assume $p_i = 2$.

Then:
 * $\phi\left({ p_i^{e_i} }\right) = \phi\left({ 2^{e_i} }\right) = p_i^{e_i - 1}\left({ p_i - 1 }\right)$

So if $e_i \geq 2$, then $2$ divides $\phi\left({ p_i^{e_i} }\right)$ and $\phi\left({ p_j^{e_j} }\right)$.

In particular $\phi\left({ p_i^{e_i} }\right)$ and $\phi\left({ p_j^{e_j} }\right)$ are not coprime.

Again by Group Direct Product of Cyclic Groups, $\left({\Z/n\Z}\right)^\times$ is not cyclic.

Thus if $\left({\Z/n\Z}\right)^\times$ is cyclic, then $n = 2^e \cdot p^\alpha$ with $e = 0$ or $e = 1$, $\alpha \geq 0$ and $p \geq 3$ prime.