Find all $n \in{N}$ satisfying $2 \leq n \leq 30$ and $ord_n (x) < \phi(n), \;\forall x \in{Z}_n^*$.
${Z}_n^* = \{x\in{Z}_n\mid(x, n)= 1\} $
${Z}_n$ = set of all residue classes $\bmod n$
My work :
$ord_n (x) < \phi(n)$, so $x$ is not primitive root.
By Primitive root theorem, $n$ is in the form $p^k, 2p^k, 2, 4$ where $p\in$ odd prime.
For $n = 2$, we have $x^2 \equiv 1 (\bmod p)$ and $\phi(p) \geq 2$ for $p \geq 3 $.
For $n = 4$,
if $p \geq 5 $, we have $x^4 \equiv 1 (\bmod p)$ and $x^2 \equiv -1 (\bmod p)$ so $\phi(p) \geq 4$.
if $p = 3 $, this contradicts $x^2 \equiv -1 (\bmod p)$.
Is my work correct ?
Please suggest how to prove in case of $p^k$ and $2p^k$.