In the notation of modular arithmetic: Another way to state this is that if p is a prime number and a is any integer that does not have p as a factor, then a raised to the p-1 power will leave a remainder of 1 when divided by p.Fermat's little theorem is the basis for the Fermat primality test.