Primitive Roots — Powers of g Cycling Around Z/pZ*
Watch g1, g2, g3, … (mod p) hop around the ring of residues. If they light up every nonzero residue, g is a primitive root; if they trace a smaller loop, g is not.
step 0
Residue ring & cycle of g
visited current ge the residue 1
Order & primitive-root test
p = 13, φ(p) = p−1 = 12
prime factors of φ = 2, 3
current exponent e = 0, ge = 1
distinct residues visited so far: 0 / 12
Stepping through the cycle…
gφ/q test (run at the end)
Press Step to multiply by g once more and watch the next residue light up. A primitive root visits all p−1 residues before returning to 1.
Self-contained visualization. The order of g is the number of steps until the cycle returns to 1; g is a primitive root iff that order equals φ(p) = p−1.
The test panel shows gφ/q for each prime q dividing φ: g is a generator iff none of these equals 1. See junior.md and professional.md for the proof.