Try this
- , : go step by step, . It takes steps to get back to . Switch to : how many steps? And ?
- Write down the number of steps for each of . How are they related to ?
- The number of steps is always a divisor of , so after exactly steps you always land on . Look at the “Fermat test” row below.
- Change to or . Is the Fermat test row all s?
- Change to or : some values of never get back to at all. What shows up in that row?
Fermat's little theorem Let be a prime and an integer not divisible by . Then
Multiply both sides by : , and this form holds for every integer .
Predict first
Mod , start at and keep multiplying by (where is not a multiple of ). The number of steps until you first get back to cannot be:
After steps you are certainly back at (Fermat's little theorem). If you return every steps, then steps must be a whole number of loops, so : the only options are . Try , and below: they take , and steps. You will never find one that takes .
Why
The proof uses nothing but the picture from the previous stop: multiplying by is a reordering.
Multiply out both sides of the reordering
Step 1 / 6- The reordering
Mod , multiply by . stays put; are sent to . These are the same six numbers, just in a different order.
Remove one condition
Break it
Counterexample lab: remove one condition
Conclusion: every not divisible by satisfies ← still true?
. All cells of the Fermat test are . Click different cells to change , then press “Finish”: the numbers of steps differ, but they are all divisors of .
Change the modulus to . Look at the Fermat test row: mod .
, not . Of the fourteen cells, only slip through; all the rest fail. Now click or and walk: they are not coprime to , and once they leave they never get back to .
Practice
Find the remainder when is divided by .
Find the remainder when is divided by .
Prove that for every integer , is divisible by .
The prime satisfies . Find .