Number TheoryHonors · Lesson 01 / 16Lesson 02 →
Lesson 01 · The multiplicative group · 50–65 minutes

Order, Euler's φ, and Primitive Roots

Multiply a nonzero residue by itself again and again modulo a prime p, and the powers must eventually return to 1. How long that takes is the order of the residue. You will find that every order divides p − 1, count exactly how many residues have each order, and prove that some residue always has the largest possible order p − 1. Such a residue, a primitive root, generates every nonzero residue as a power.

Where this lesson is headed

ap−1 ≡ 1 (mod p),   ordp(a) | p − 1,   #{a : ordp(a) = d} = φ(d) for every d | p − 1

In words: the powers of any a run around a cycle whose length divides p − 1, and exactly φ(d) residues have cycle length d. Taking d = p − 1 shows primitive roots exist, and there are φ(p − 1) of them.

You will use (proved in the Growing Clock)

If gcd(a, m) = 1 then a has an inverse modulo m, so multiplication by a permutes the residues coprime to m (Lesson 02, step 4). A prime dividing a product divides a factor (Lesson 04, step 4). The Chinese Remainder Theorem (Lesson 07).

p: an odd prime

a: a residue with p ∤ a

(ℤ/pℤ)× = {1, 2, …, p − 1} under multiplication mod p

ordp(a): the least k ≥ 1 with ak ≡ 1 (mod p)

φ(n): #{1 ≤ k ≤ n : gcd(k, n) = 1}

primitive root: a residue g with ordp(g) = p − 1

01. The powers of a residue

Start with p = 7 and a = 2. The powers 1, 2, 4, 8 ≡ 1 return to 1 after 3 steps, so ord7(2) = 3, and they only visit half the circle. Step through the powers, then try other a and other primes. (Shortcut: Space takes the next power, ← goes back.)

The powers of a on (ℤ/pℤ)×

Exponent k0
ak mod p1
ordp(a)?

Guided experiments

Do these in order. "Set this up" chooses p and a.

    Euler's φ

    φ(n) counts 1 ≤ k ≤ n with gcd(k, n) = 1. The counts in the table above keep matching φ of the order, so we need to be able to compute φ.

    A composite warning

    Primitive roots are special to primes (and a few other moduli). Modulo 8 the units are 1, 3, 5, 7, and each squares to 1: no unit has order φ(8) = 4.

    Every order divides p − 1, and exactly φ(d) residues have order d. Stage 02 explains why.