Theory We know what Fermat's little theorem states. If p is a prime number, then for any integer a, the number a^p − a is an integer multiple of p. In the notation of modular arithmetic, this is expressed as a^{p}\equiv a{\pmod {p}}.
So, essentially, for every (a,m)=1, {a}^{\phi (m)}\equiv 1 \pmod {m}. But \phi (m) isn't necessarily the smallest exponent. For example, we know 4^{12}\equiv 1\mod 13 but so is 4^6. So, we care about the "smallest" exponent d such that a^d\equiv 1\mod m given (a,m)=1. Orders Given a prime p, the order of an integer a modulo p, p\nmid a, is the smallest positive integer d, such that a^d \equiv 1 \pmod p. This is denoted \text{ord}_p(a) = d. If p is a primes and p\nmid a, let d be order of a mod p. Then a^n\equiv 1\pmod p\implies d|n. Let n=pd+r, r\ll d. Which implies a^r\equiv 1\pmod p. But d is the smallest natural number. So r=0. So d|n. Show that n divid...