Proof

If \(a\) is an integer, \(p\) is a prime number, and \(a\) is not divisible by \(p,\) then \(a^{p - 1} \equiv 1 \pmod{p}\)
Watch this or this, or read this or this.
If \(a\) is an integer, \(p\) is a prime number, and \(a\) is not divisible by \(p,\) then \(a^p \equiv a \pmod{p}\)