How can i get the least $n $ such that $17^n \equiv 1 \mod(100$)? When I solve the problem:
$17^{2018}\equiv r \pmod{100} $
used Euler theorem since $\gcd (17,100)=1$ and so
$\phi(100)=40$ 
and so
$17^{40}\equiv 1 \pmod{100}$
But i also found that:  $17^{20}\equiv 1 \pmod{100}$
How can i get the least n such that $17^{n}=1\pmod{100} $?
Is there any theorm or generalization to this problem? 
Thanks for your help 

$$17^n\equiv (10+7)^n\equiv 7^n+n\cdot 7^{n-1}\cdot 10 \mod 100 $$
Coincidentally,
$$7^4 \equiv 1 \mod 100$$
$$\rightarrow 7^{-1}\equiv 7^3 \equiv 43 \mod 100$$
So we need to find the smallest $n$ such that,
$$7^n+n\cdot 7^{n-1}\cdot 10  = 7^n+n\cdot 7^{n}\cdot 43\cdot10\equiv 7^n(1+30\cdot n)\equiv 1\mod 100$$
$$7^{-n}\equiv 30n+1 \mod 100$$
However $7^n$ has only 4 possibilities -> ($7,49,43,1$). Only one of these can be of the form $30n+1$.
$$30n+1 \equiv 1 \mod 100$$
Implying that $10|n$
Also, $7^4\equiv 1 \mod 100$ implying that $4|n$
The smallest $n$ satisfying these conditions $n=20$
