2.5.11 · D4Number Theory (Intermediate)

Exercises — Fermat's little theorem (statement)

2,067 words9 min readBack to topic

Everything rests on one line, so let us pin it down before we lean on it.

Figure — Fermat's little theorem (statement)

The figure above is our mental picture for the whole page: a clock with hours. Multiplying by just reshuffles the hour-marks , and after steps of a certain journey you always return to . Keep it in mind.


Level 1 — Recognition

Here you only decide whether the theorem applies and read off the trivial consequence. No heavy arithmetic.

Recall Solution 1.1

The classical form needs both " prime" and "".

  • (a) is prime and applies. So .
  • (b) is not primedoes not apply. FLT says nothing here (you would need Euler's theorem).
  • (c) is prime but does not apply. Here , so .
  • (d) prime, applies, and trivially .
Recall Solution 1.2

Both cases: prime, (since and are nonzero and is prime, neither shares a factor with ).

  • (a) .
  • (b) . The whole point of L1: once the two conditions pass, the answer to is always — you never actually multiply.

Level 2 — Application

Now you actually compute, but the exponent is close to so the theorem does most of the work.

Recall Solution 2.1

prime, , and the exponent is exactly . So directly by Form 1: (Sanity check: . ✓)

Recall Solution 2.2

prime, .

  • by Form 1 (exponent ).
  • . This is Form 2 in action: . Answers: , .
Recall Solution 2.3

prime, , exponent , so . Verify: , so . ✓ Answer: .


Level 3 — Analysis

The exponent is now large and not a clean multiple of . You must reduce it first.

Recall Solution 3.1

prime, , so . We want to write using multiples of : Then Compute , so . Answer: .

Recall Solution 3.2

prime, so . Reduce the exponent modulo : Hence . Now , so . Answer: . (This "extra " is fine — it just means has a smaller cycle, order , dividing .)

Recall Solution 3.3

Careful: , so Form 1 does not apply. But , so Every power of a multiple of stays . Form 2 also confirms consistency: . Answer: .


Level 4 — Synthesis

Combine FLT with modular inverses and multi-step arguments.

Recall Solution 4.1

Since , the inverse is . , , . Then . Check: . ✓ Answer: .

Recall Solution 4.2

Proof. is prime. Two cases:

  • If : Form 1 gives , so .
  • If : then , and . Both cases give . This covers all integers. Computation. , so (by the identity just proved). Answer: .
Recall Solution 4.3

First reduce the base: , so . Now . , , so . Reduce the exponent mod : , so Answer: .


Level 5 — Mastery

Reason about where FLT stops working and how it is generalized.

Recall Solution 5.1

(a) FLT is a one-way statement: " prime ." It says nothing about composite moduli. A composite may accidentally satisfy ; here does so for . That's a coincidence permitted by the theorem, not a violation. (b) The converse " prime" is what a naive test would use — and it is false. is a counterexample (a Fermat pseudoprime to base ). See Carmichael Numbers for composites that fool every base. Practically: passing the test proves nothing on its own; failing it (some coprime with ) does prove compositeness. Answer: No contradiction; the converse is invalid, which is the whole reason single-base Fermat tests are unreliable.

Recall Solution 5.2

Take (and ). , so , which is not . So even with a coprime base, the classical exponent fails when is composite. The correct exponent comes from Euler's theorem: , and indeed . Answer: ; primality is essential.

Recall Solution 5.3

, and , so Euler guarantees . Check: already — the true order is , which divides the guaranteed (orders always divide the guaranteed exponent). Using : Answers: Euler guarantees ; and .


Recall One-page skill checklist (self-test)

Before applying the classical form: ☐ Is prime? ☐ Is ? Reduce the base mod ::: yes, always shrink first Reduce the exponent mod ::: only when ; period is Exponent equals ::: answer is Exponent equals ::: answer is (Form 2) Modular inverse of mod prime ::: Composite modulus ::: use Euler with , not FLT

Connections

  • Fermat's little theorem (statement) — the parent statement these exercises drill.
  • Modular Arithmetic Basics — remainders, congruence, reducing base and exponent.
  • Euler's Totient Function — the composite-modulus generalization used in L5.
  • Wilson's Theorem — a companion prime-only identity.
  • Carmichael Numbers — composites that fool the Fermat test for every base.
  • Multiplicative Group Modulo Prime — why the exponent cycle has length .
  • Modular Exponentiation Algorithms — fast squaring used in the large-exponent problems.
  • RSA Cryptosystem — where modular inverses and FLT-style reasoning power real cryptography.