Skip to content
Theorem

Fermat's little theorem

Arithmetic • Number System • Divisibility

Formula

If is a prime and is an integer not divisible by , then .

How to use it

  1. 1Check both conditions first: the modulus must be prime, and the base must not be a multiple of it.
  2. 2When the exponent is exactly the remainder is outright; when it is larger, write the exponent as and the power reduces to .
  3. 3Use it to collapse an otherwise impossible power: follows by multiplying both sides by .

Worked example

What is the remainder when is divided by ?

Step-by-step

  1. 1
    is prime and

    Why: Both conditions of the theorem are met.

  2. 2

    Why: The exponent is exactly , so the theorem applies directly.

Answer

Watch out

The primality of is essential: , not , because is not prime. The theorem also says nothing when , where the power is instead.

Builds on

Also known as

a^(p-1) = 1 mod p, remainder of a large power, little Fermat, power mod a prime

Appears in past papers

2017 (I)

2016 (II)