If is prime and does not divide , multiplying each nonzero residue modulo by produces the same residues in a different order. Their products are congruent and can be canceled.
Prove Fermat's little theorem: if is prime and integer is not divisible by , then leaves remainder 1 when divided by .
Consider modulo . The residues of are all nonzero and distinct: if and were equal modulo , then would divide , forcing in the stated range.
The two lists are permutations of one another, so is congruent to modulo .
None of the factors in is divisible by , so the product has a multiplicative inverse modulo . Canceling it gives the claimed congruence.
Screenshot any problem on your screen and get the steps. Chrome on a computer; free.