Fermat’s Little Theorem - Statement, Proof with Example
Fermat Little Theorem also known as Fermat remainder theorem, is a fundamental result in number theory that deals with properties of prime numbers and modular arithmetic.
Fermat’s Little Theorem States that -
if p is a prime number and a is an integer such that a is not divisible by p, then
a^{p-1} \equiv 1 \pmod{p} .
This means that when ap−1 is divided by p, the remainder is 1.
This also can be written as ap ≡ a (mod p).
For Example -
Let's take p = 7 (a prime number), and a = 3. According to the Fermat's Little Theorem :
3^{7-1} = 3^6 \equiv 1 \pmod{7}
This means when you calculate 36 and divide it by 7, the remainder is 1.
Proof of Fermat's Little Theorem
Let p be a prime number, and a be an integer such that a is not divisible by p. Consider the set of numbers formed by multiplying a with integers from 1 to p−1:
S = {a, 2a, 3a, . . . ,(p − 1)a}
Assume that for two numbers i and j such that 1 ≤ i, j < p, the products ia ≡ ja (mod p).
- If ia ≡ ja (mod p), then (i − j)a ≡ 0 (mod p).
- Since p is prime and a is not divisible by p, this implies that p must divide i − j.
- However, 1 ≤ i, j < p means that i − j cannot be divisible by p unless i = j.
Thus, all the products a, 2a, . . . ,(p − 1)a a are distinct modulo p.
The product of all the elements in S is:
a ⋅ 2a ⋅ 3a . . . (p − 1)a = ap−1 ⋅ [1 ⋅ 2 ⋅ 3 ⋯ (p−1)] = ap−1 ⋅ (p − 1)! . . . (i)
Note: 1 ⋅ 2 ⋅ 3 ⋅ . . . ⋅ (p−1) is the product of all integers from 1 to p − 1, which is known as (p − 1)! (the factorial of p − 1).
By Wilson's theorem, we know that:
(p−1)! ≡ −1 (mod p).
Thus, the equation (i) becomes:
(p−1)! ⋅ ap−1 ≡ −1 ⋅ ap−1 .
Since (p−1)! ≡ −1 (mod p), we rewrite the equation as:
−1 ⋅ ap−1 ≡ −1 (mod p)
Multiplying both sides by −1, we get:
ap−1 ≡ 1 (mod p)
Which is the required result.
Examples of Fermat's Little Theorem
Example 1: Find the remainder when 7100 is divided by 13.
Solution:
Since 13 is a prime number, we can apply Fermat's Little Theorem, which states:
ap−1 ≡ 1 (mod p)
where p is a prime number, and a is an integer not divisible by p.
Here, a = 7 and p = 13. By Fermat's Little Theorem:
712 ≡ 1 (mod 13)
7100 = 712×8+4 = (712)8 ⋅ 74
By Fermat’s Little Theorem:
(712)8 ≡ 18 ≡ 1 (mod 13)
Therefore:
7100 ≡ 74 (mod 13)ap−1 ≡ 1 (mod p)
Now, 72 = 49 ⇒ 49 ÷ 13 = 3 remainder 10
Thus: 72 ≡ 10 (mod 13)ap−1 ≡ 1 (mod p)
Now: 74 ≡ (72)2 ≡ 102 ≡ 100 (mod p)
Again, reducing 100 modulo 13:
100 ÷ 13 = 7 remainder 9
Thus: 74 ≡ 9 (mod 13).
Result: Remainder when 7100 is divided by 13 is 9.
Example 2: Find the remainder of 3100,000 when divided by 53.
Solution:
Since 53 is a prime number, we can apply Fermat's Little Theorem.
Fermat's Little Theorem states:
ap−1 ≡ 1 (mod p)
where p is a prime number and a is an integer not divisible by p.
Here, a = 3 and p = 53, so:
352 ≡ 1 (mod 53)
3100,000 = 352×1923+4 = (352)1923 ⋅ 34
By Fermat's Little Theorem:
(352)1923 ≡ 11923 ≡ 1 (mod 53)
Thus: 3100,000 ≡ 34(352)1923 ⋅ 34
34 = 3 × 3 × 3 × 3 = 81
Now, reduce 81 modulo 53:
81÷53=1 remainder 28
Thus:
34 ≡ 28 (mod 53)
Thus, 3100,000 = 28 (mod 53)
Result: Remainder when 3100,000 is divided by 53 is 28.
Worksheet on Fermat’s Little Theorem

You can download the free worksheet on Fermat’s Little Theorem with answer key from below:
Conclusion
Fermat’s Little Theorem is a powerful tool in number theory that helps us work with large numbers and modular arithmetic efficiently. It tells us that for any integer a that is not divisible by a prime number p, the expression ap−1will leave a remainder of 1 when divided by p.
Read More,