Page 1 of 9 · Overview

Lesson 7 of 8 · Number Theory

Fermat's Little Theorem & Euler's Totient

You've already been reducing exponents mod 4 to find units digits — Fermat's Little Theorem is the general version of that trick for any prime modulus, and Euler's totient function extends it to any modulus at all. Both turn intimidatingly large powers into a handful of small computations.

Mark your status for this lesson:

Learning objectives

  • Apply Fermat's Little Theorem to reduce a huge exponent mod (p−1) when the modulus p is prime.
  • Compute Euler's totient φ(n) using its multiplicative formula from n's prime factorization.
  • Apply Euler's theorem to reduce exponents mod φ(n) for a composite modulus, when the base is coprime to it.
  • Recognize when an exponent one short of the full cycle length gives a modular inverse directly.