Prime Test
We know that if n is prime, then:
{a^(n-1)}%n=1 [Fermat primality test]
Can anyone explain its mathematical proof?
Codeforces Round 953 Div 2 Solution Discussion (with Jan)