FP2 5.4 - Fermat's little theorem
Use Fermat's little theorem to reduce large powers modulo a prime (FP2 5.4). You will check its conditions, reduce exponents, use convenient signed bases and finish with the requested residue.
Check the prime modulus and the base
What is the remainder when is divided by ? Expanding the power would bury the answer in an enormous integer. Fermat's little theorem lets you replace long stretches of multiplication by a return to residue .
You already know
With a fixed modulus, congruences are preserved by multiplication and positive integer powers. A negative representative is allowed during working. The least nonnegative residue lies in ; the least positive representative lies in .
Here is the concrete pattern behind the shortcut: modulo , repeatedly multiplying by eventually returns to , with . The theorem gives such a guaranteed return for every base not divisible by a prime modulus.
Fermat's little theorem
If is prime and is an integer not divisible by , then
An equivalent form, valid for every integer when is prime, is
The first form requires . If , every positive power of is congruent to .
Not in the formula booklet: learn it.
For a prime , either or . Multiplying the first form by gives the second in the coprime case; the divisible case gives zero on both sides. Conversely, safe cancellation of in the second form gives the first when . A proof of the theorem itself is not required.
Worked example 1: both forms apply
Question. Use Fermat's little theorem to determine the least nonnegative residues of and modulo .
Plan. Check that the modulus is prime and the base is not divisible by it, then identify the exponents and .
Why this step? The exponent yielding residue is one less than the prime modulus, not the prime modulus itself.
Answer. The residues are and , respectively.
Check. , so ; one more factor of gives residue .
Change only the base from to , keeping the two exponents and the modulus fixed. One theorem condition now fails.
Worked example 2: the base is divisible by the prime
Question. Determine the least nonnegative residues of and modulo . Explain which form of Fermat's little theorem applies.
Plan. Check divisibility before using the form; use the power law for a zero residue.
Why this step? The statement would use the first form outside its domain.
Answer. Both residues are . The form applies, but the form does not.
Check. Every positive power of contains a factor of .
The modulus and the base play different roles: primeness is a condition on the modulus, while coprimality is the additional condition for the form.
Watch out
Do not write as Fermat's theorem. With , the correct line is ; the exponent that gives is . Also check before using that form.
State the applicable theorem before reducing powers; this makes the role of its conditions visible.
Remove complete blocks of the exponent
Once , every complete block of factors contributes residue . Divide the exponent by , then retain its remainder.
Exponent reduction using Fermat
For prime , integer with , and nonnegative integer , write
Then
When , the retained power is .
Not in the formula booklet: learn it.
This reduces the exponent modulo ; the value of the power is still reduced modulo . Those are different jobs.
Worked example 3: a thousand factors become four
Question. Use Fermat's little theorem to determine the least positive residue of modulo . Show detailed reasoning.
Plan. State the theorem for this base and prime, divide by , then evaluate only the retained power.
Why this step? Reducing the exponent before calculating the remaining power is precisely the use of Fermat's theorem requested in the question.
Answer. The least positive residue is .
Check. , and .
Increase only the exponent by . The same complete blocks remain, but the retained power gains one factor of .
Worked example 4: one extra factor
Question. Use Fermat's little theorem to determine the least positive residue of modulo .
Plan. Use the same theorem and divide the new exponent by ; reuse the known residue of .
Why this step? A remainder of means retain , rather than replacing the whole power by the integer .
Answer. The least positive residue is .
Check. , so it is the next residue after in the repeated-multiplication cycle.
Continue this lesson.
You’re previewing NovaLearn without an account. Create a free account to read the rest.
Create free account