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
Euler's phi function, $\varphi(n)$, is a multiplicative function for which, if $a$ and $N$ are relatively prime, then $a^{\varphi(N)} \equiv 1 \pmod N$. In particular
$$\varphi(100) = \varphi(4)\varphi(25) = (4-2)(25-5)=40$$
So $17^{40} \equiv 1 \pmod{100}$. The smallest $n$ such that $17^n \equiv 1 \pmod{100}$ must therefore be a divisor of $40$.
The divisors of $40$ are $$1, 2, 4, 5, 8, 10, 20, 40$$
\begin{align} 17^1 &\equiv 17 \pmod{100} \\ 17^2 &\equiv 17\times17 \equiv 89 \pmod{100} \\ 17^4 &\equiv 89\times 89 \equiv 21 \pmod{100} \\ 17^5 &\equiv 17\times 21 \equiv 57 \pmod{100} \\ 17^8 &\equiv 21\times 21 \equiv 41 \pmod{100} \\ 17^{10} &\equiv 57\times 57 \equiv 49 \pmod{100} \\ 17^{20} &\equiv 49\times 49 \equiv 1 \pmod{100} \end{align}
Added 6/8/2019
In response to the comment of @labbhattacharjee, $\lambda(n)$, the Carmichael function of n, is defined by
For any power of a prime number, $n = p^\alpha$,
$$\lambda(n) = \begin{cases} \frac 12\varphi(n) & \text{If n is a power of $2$ that is $\ge 8$ }\\ \varphi(n) & \text{Otherwise} \end{cases}$$
For any prouduct of powers of unique prime numbers, $n=p_1^{\alpha_1} p_2^{\alpha_2} \dots p_k^{\alpha_k}$,
$$\lambda(n) = \operatorname{LCM} \{\lambda(p_1^{\alpha_1}), \lambda(p_2^{\alpha_2}), \dots, \lambda(p_k^{\alpha_k})\}$$
So
\begin{align} \lambda(100) &= \lambda(2^2 \cdot 5^2) \\ &= \operatorname{LCM}\{\lambda(2^2),\lambda(5^2)\} \\ &= \operatorname{LCM}\{\varphi(2^2),\varphi(5^2)\} \\ &= \operatorname{LCM}\{2,20 \} \\ &= 20 \end{align}