I need help with the following problem:
Find the smallest positive integer $n$ such that
$$x^n \equiv 1 \pmod{101}$$ for every integer $x$ between $2$ and $40$.
How can I approach this? Using Euclid's? Fermat's?
I know Fermat's says if $p$ is a prime, then $x^{p−1} \equiv 1 (\mod p) $but I don't know how or if I can apply it. As you can probably tell I'm very confused by modular congruences
$101$ is prime. $2^{100} \equiv 1 \mod 101$. Is there any smaller $n$ that works for $x=2$? Note that all the $n$ you really need to try here are $20$ and $50$.
EDIT: This can also be done without much computation. There are $\varphi(100) = 40$ primitive roots mod $101$. Note that since $101 \equiv 1 \mod 4$, $-x$ is a primitive root mod $101$ if and only if $x$ is. Thus if there were no primitive roots from $1$ to $40$, there would also be none from $61$ to $100$. But there are only $20$ integers from $41$ to $60$, so there isn't room for all the primitive roots there.