Fermat's Little Theorem

Fermat's Little Theorem states that if \(p\) is a prime number, then for any integer \(a\), the number \(a^p - a\) is an integer multiple of \(p\),

\[ a^p \equiv a \pmod{p}\,.\]

When \(\gcd(a, p) = 1\), then,

\[ a^{p-1} \equiv 1 \pmod{p} \,.\]