Find all integers $n$ such that the group of units of $\mathbb{Z}/n\mathbb{Z}$ is an elementary abelian $2$-group. Question: Find all integers $n$ such that the group of units of $\mathbb{Z}/n\mathbb{Z}$ is an elementary abelian $2$-group.
Thoughts: I know that $u$ is a unit in $\mathbb{Z}/n\mathbb{Z}$ if and only if $n$ and $u$ are coprime.  So, in each ring, there are $\phi(n)$ units.  But I am not sure if there is a "nice" way to see if every non-trivial element in $U(n)$ has order $2$.  I was thinking of breaking it down into even and odd $n$, or considering how many units each ring has, but I wasn't able to notice anything useful.  Any help is greatly appreciated!  Thank you.
The question is asked here: For what values of $n$ is $U(\mathbb{Z}_n)$ an elementary abelian 2-group?, but I wasn't able to get to a conclusion on based on the last hint.
 A: By Robert Shore's comment, for odd $n$, we have only $n=3$ working.
For even $n$, write $n=2^k m$ with odd $m$. By CRT as suggested by Arturo Magidin,
$$
(\mathbb{Z}/n\mathbb{Z})^* \simeq (\mathbb{Z}/2^k\mathbb{Z})^* \times (\mathbb{Z}/m\mathbb{Z})^*. 
$$
Again if $m>3$, there is an element of order greater than $2$. Thus, we have $m=1, 3$.
If $k\geq 2$, then we have
$$
(\mathbb{Z}/2^k\mathbb{Z})^* \simeq (\mathbb{Z}/2\mathbb{Z})\times (\mathbb{Z}/2^{k-2}\mathbb{Z}).
$$
So, the group has an element of order greater than $2$ if $k>3$.
Hence, we must have
$n=1,2,3,4,6,8,12,24$.
Here, $n=1,2$ yield trivial groups. $n=3,4,6$ yield $\mathbb{Z}/2\mathbb{Z}$, and $n=8,12$ yield $(\mathbb{Z}/2\mathbb{Z})^2$, $n=24$ yield $(\mathbb{Z}/2\mathbb{Z})^3$.
A: Using the Chinese Remainder Theorem, since the units of $A\times B$ are $U(A)\times U(B)$, and a product is elementary $2$-abelian if and only if both factors are elementary $2$-abelian, we can reduce first to the prime power case. The answer then will be any $n$ that can be written as a product of "suitable" prime powers.
If $p$ is an odd prime, then $(\mathbb{Z}/p^a\mathbb{Z})^*$ is cyclic of order $p^{a-1}(p-1)$. For this to be elementary $2$-abelian, we need this number to be $2$ (the only cyclic elementary $2$-abelian group). So $a=1$ and $p=3$.
For powers of $2$, the unit group of $\mathbb{Z}/2^a\mathbb{Z}$ is: trivial if $a=1$; cyclic of order $2$ if $a=2$; and isomorphic to $\mathbb{Z}/2\mathbb{Z}\times\mathbb{Z}/2^{a-2}\mathbb{Z}$ if $a\geq 3$. So this is elementary $2$-abelian if and only if $a\leq 3$.
Thus, $n$ must be of the form $n=2^a3^b$ with $0\leq a\leq 3$ and $0\leq b\leq 1$.
