---
title: "Primitive Roots and the Units Modulo n"
description: "Ask when the units modulo n are generated by a single element, and settle which n admit one."
canonical: https://lightmysky.com/learn/mathematics/primitive-roots-and-the-units-modulo-n-mt_KwTDckkMze
source: https://lightmysky.com/learn/mathematics/primitive-roots-and-the-units-modulo-n-mt_KwTDckkMze.md
retrieved: 2026-09-12
---

> **Agent view.** This is the Markdown twin of the page, for tools and assistants.
> When to use this site, and the call that answers each job: https://lightmysky.com/agent-instructions.md
> API description (OpenAPI 3.1): https://lightmysky.com/openapi.json · Authentication: https://lightmysky.com/auth.md
> Pricing: https://lightmysky.com/pricing.md · Catalog: https://lightmysky.com/llms.txt · Full catalog: https://lightmysky.com/llms-full.txt
> Every machine-readable file on this domain: https://lightmysky.com/.well-known/ai-catalog.json
> Ask for Markdown with `Accept: text/markdown`, a `.md` address, or `?mode=agent`.

# Primitive Roots and the Units Modulo n

Ask when the units modulo n are generated by a single element, and settle which n admit one.

Subject: Mathematics · Area: Number Theory · Ages 20 to 21
Page: https://lightmysky.com/learn/mathematics/primitive-roots-and-the-units-modulo-n-mt_KwTDckkMze

## Ready when they can

- Compute the order of an element modulo n and relate it to the totient
- Find a primitive root modulo a small prime and use it to index the other units
- State which moduli have primitive roots and give a modulus that does not

## Lesson: Finding a generator for the units

Modulo n, the remainders coprime to n are called units. The order of a unit is the smallest k with a to the k equal to 1 modulo n, and it always divides phi of n. Powers of 2 modulo 5 go 2, 4, 3, 1, so the order of 2 is 4.

**Example.** A primitive root is a unit whose order equals phi of n, so its powers list every unit. Modulo 5 the powers 2, 4, 3, 1 cover all four nonzero remainders, which makes 2 a primitive root there.

Test candidates by computing powers, reducing modulo n each time. Modulo 7, powers of 2 go 2, 4, 1, so the order is 3, while powers of 3 run 3, 2, 6, 4, 5, 1, reaching all six units. That makes 3, not 2, a primitive root modulo 7.

**Tip.** Only some moduli own primitive roots: 2, 4, prime powers, and twice prime powers. Modulo 8 has none, since every odd square is 1 there while phi of 8 is 4. Always check coprimality first: testing a non unit goes nowhere.

**Recap.** Order measures the wait until powers return to one, and a primitive root is a unit with the longest possible wait.

## Practice

14 questions on this page, each with its working shown.

## Needs first

- [Fermat's Little Theorem and Euler's Theorem](https://lightmysky.com/learn/mathematics/fermats-little-theorem-and-eulers-theorem-mt_7wW4z4Eidx)
- [Groups, Subgroups and Symmetry](https://lightmysky.com/learn/mathematics/groups-subgroups-and-symmetry-mt_HFAhcaGo2L)

## Opens up

- [Quadratic Residues and the Law of Reciprocity](https://lightmysky.com/learn/mathematics/quadratic-residues-and-the-law-of-reciprocity-mt_0KS9eTCY4p)
