Given a prime \(p\) and some integer \(a\), we can use Euler's theorem to say:
$$ (a, p) = 1 \implies a^{\phi(p)} ≡ 1 \mod p $$
By definition of prime \(p\), all numbers in it's complete residue system other than \(p\) itself is coprime. In other words, \( \phi(p) = p - 1 \):
$$ a^{p-1} ≡ 1 \mod p $$
This would also mean:
$$ a^p ≡ a \mod p $$
If \(p | a\), then \(a ≡ 0 \mod p\).