Recall.
- Definition $1$. $Ord_n(a)$ is the smallest number $m$ st. $\quad a^{m} \equiv 1(\bmod n)$
- Definition $2$. We say $r$ is a primitive root modulo $n$ if $\operatorname{Ord}_{n} (r)=\phi(n)$
- Note: $\left\{1,r, r^2,..., r^{\phi(n)-1}\right\}=U_n$
I want to find $r$ such that $ord_{18} (r)=\phi(18)=6$, that is we get by definition 1: $r^{m} \equiv 1(\bmod 18)=6$, so hence can I find $r$?
As $(r,18)=1,(r,6)=1$
As $\phi(18)=6,$ord$_{18}r$ must divide $6$
Now $5^2\equiv7\not\equiv1,5^3\equiv-1\not\equiv1\pmod{18}$
$\implies$ord$_{18}5=6$
Finally use
What integers have order $6 \pmod {31}$?