Britannica Sources used in this answer

What does Fermat’s little theorem say about a prime number p and an integer a?

Created from Britannica articles using AI. AI can make mistakes, so verify using Britannica articles.

Fermat’s little theorem (also referred to as Fermat’s lesser theorem) is a fundamental result in number theory first stated by the French mathematician Pierre de Fermat in 1640.12

The theorem states that for any prime number p and any integer a, the value ap−a is divisible by p. In other words, p divides exactly into ap−a.12

While Fermat did not leave behind a known proof for this theorem, it was later proved by Gottfried Wilhelm Leibniz and Leonhard Euler. The theorem provides a test that is necessary but not sufficient for determining whether a number is prime, as some composite numbers—known as pseudoprimes—can also satisfy the condition.12