One residue whose powers are all of them
Worth reading first: Necklaces that prove a theorem · Numbers that wrap.
Necklaces that prove a theorem ends with a remark and moves on: the multiplicative order of a residue divides , and that observation is the beginning of a subject. Here is the subject.
Fix a prime and take a residue that is not zero. Multiply it by itself repeatedly. The sequence must eventually repeat, and since multiplication by the residue can be undone, the first repeat is a return to the start — so the powers form a closed ring whose length is the residue’s order. Fermat’s theorem is the statement that the length divides .
What Fermat’s theorem does not say
The ring above has twelve beads and there are twelve residues, so the powers of two are all of them. That is a much stronger statement than the order divides twelve, and nothing in the necklace argument produces it.
To see the gap, take another base on the same modulus.
Five has order four. Four divides twelve, so the theorem holds, and the powers of five reach four residues out of twelve. A divisor of is not , and a theorem that only bounds the order says nothing about whether anything achieves it.
A residue whose order is exactly is called a primitive root, and the claim that one always exists is a separate theorem. It is also a much more useful one: a primitive root turns multiplication into addition, since every residue is for exactly one between and , and multiplying two residues adds their exponents. Everything multiplicative about the modulus becomes arithmetic on a single dial of positions — and a dial is the object numbers that wrap is about, so the theorem says one wrapping arithmetic sits inside another in a way the notation hides completely.
The count that forces one to exist
The existence proof is a count, and it is the same kind of count an earlier essay runs — partition a set into classes of known size, and read a conclusion off the sizes.
The claim is: for every divisor of , exactly residues have order , where counts the numbers up to sharing no factor with it. The last row of that table is , and of anything is at least one, so a residue of full order exists.
The argument has two halves and both are worth having, because the first is easy and the second is where the primality is spent.
At most residues have order . Suppose one does, say . Then the powers of all satisfy . A polynomial of degree over the residues modulo a prime has at most roots — this is where primality enters, and it fails badly for composites — so those powers are all the solutions of . Any residue of order satisfies that equation, so it is among the powers of ; and has order exactly when shares no factor with . So there are either none of order or exactly .
That first half is a genuine use of primality and it is worth isolating, because it is the only one. A polynomial of degree having at most roots is a statement that holds over any field and fails over the residues modulo a composite: has four roots modulo fifteen, so the bound is not a formality. The same fact settles how many solutions an equation can have over a finite field, and it is the reason the two subjects share their arithmetic.
And the totals leave no room for “none”. Every residue has some order, and every order divides , so the counts over the divisors of must add to . If any divisor contributed nothing, the total would fall short — because the totients of the divisors of already add to exactly .
The identity underneath, which is not about primes
The identity is the load-bearing part, and its proof is a partition rather than a computation. Sort the numbers to by their greatest common divisor with . The numbers whose greatest common divisor is are exactly the multiples of that share nothing else with , and writing such a number as , the condition on is that it is at most and shares no factor with . So that class has members.
Every number is in exactly one class, so the classes add to . That is the whole proof, and nothing in it mentions primes — the identity is true for every , which is worth noticing because it is the half of the existence argument that carries no hypothesis. The hypothesis is all in the polynomial-root bound above, and that is where the composite cases will break.
Counting one set in two ways is the most productive habit in this subject, and the shape here is the standard one: the left-hand side sorts by a property and adds up the classes, the right-hand side counts the whole thing directly, and the identity is the statement that both count the same set. Quadratic reciprocity is the same move on a much larger scale, and Fermat’s own theorem is it on a smaller one.
The other proof, which builds a generator out of pieces
There is a second route to the same theorem and it is worth having, because it constructs rather than counts and because the tool it uses is needed again where the modulus is composite.
Start from a fact about combining orders, which is not the obvious one. If has order and has order , the order of is not generally , and it is not generally the least common multiple either — modulo thirteen, has order twelve and has order twelve, and their product is , which is one on a dial of thirteen and so has order one. What is true is a restricted version: if and share no factor, then has order exactly .
The proof of that is short. , so the order divides . Conversely, if then raising to the power kills and leaves , so divides ; since shares no factor with it divides . The same argument the other way gives , so . The coprimality is used exactly twice and the statement is false without it.
Now the construction. Let be the largest order that occurs among the residues. Every order divides — because if some residue had order not dividing , some prime power in would exceed the one in , and the combining fact above would build a residue of order larger than out of suitable powers of the two. So every residue satisfies , an equation of degree with solutions, and the root bound forces . Since divides , it is , and the residue achieving it is a generator.
Both proofs spend primality in the same place and nowhere else — the root bound — and they differ in what they hand over. The counting proof gives the exact number of residues of each order and no construction; this one gives a recipe for assembling a high-order element from lower-order ones and no count. Having both is what makes the composite case tractable, because is a quantity in its own right and the argument above is the one that computes it when the modulus is not prime and falls short.
The generators, and how many of them there are
The table gives the count of generators for free: there are of them. Modulo thirteen that is , and the four are . Modulo seventeen it is , so half the residues generate.
Modulo eleven there are , and modulo the small primes the counts are — a sequence that does not increase, because it depends on the factorisation of rather than on .
The proportion is worth a moment because it is neither small nor predictable. can be as large as a half — when is twice a prime — and it can be pushed down towards nothing by choosing with many small prime factors, since each distinct prime factor multiplies the proportion by . There are primes for which fewer than a fifth of the residues generate, and there is no upper bound on how small the fraction can be made.
Nothing in the existence proof locates a generator. The count says four exist modulo thirteen and gives no procedure for finding one beyond testing residues in turn, and testing a residue means computing its order. For a prime of several hundred digits, testing is feasible if the factorisation of is known — a residue is a generator exactly when for every prime dividing — and is not feasible otherwise. So the theorem is an existence statement whose constructive version needs a factorisation, which is the standing shape of this subject.
There is a conjecture that sharpens the question and has been open since 1927. Artin conjectured that a fixed base that is not a perfect square and not — two, say — is a primitive root for infinitely many primes, indeed for a positive proportion of them. It is unproved. What is known is due to Heath-Brown in 1986: at most two prime values of the base can fail, so at least one of , and satisfies the conjecture and nobody can say which.
The dial the generator provides, and what lives on it
Once a generator is fixed, every unit has an address: the exponent that reaches it. Writing the addresses out turns the multiplicative structure into an additive one, and several facts that are awkward in one language are immediate in the other.
The order of is , which is the statement that the powers of are the multiples of on a dial of positions — and the multiples of on such a dial form a sub-dial whose size is divided by what and share. That single formula produces every count in the table above: the residues of order are the with , and there are such by the same class-counting the identity above is about.
It also explains why the divisor structure of matters so much and the size of hardly at all. A prime with for prime has only four divisors, so only four possible orders, and half its residues generate. A prime with highly composite has many orders and few generators. The arithmetic of the modulus has almost dropped out and been replaced by the arithmetic of , which is the change of coordinates the generator performs.
The same relabelling is what makes the finite field with elements look like a familiar object: its non-zero elements are a single ring under multiplication, and every element is a power of one is that statement for the fields with elements as well, where the count of generators is and the argument is the same one.
Where it fails, and the shape of the failure
For a composite modulus the theorem usually fails, and the figure locates the exceptions rather than describing them. A generator exists modulo exactly when is , , , a power of an odd prime, or twice one. Eight, twelve, fifteen, sixteen and twenty have none.
The reason is exactly the step the proof spent its primality on. Modulo fifteen the equation has four solutions — — where a prime modulus permits at most two, and the four are what make a generator impossible: a generator’s powers would have to contain all four, but a cyclic ring has only one element of order two.
That failure is not a small exception. It means the units modulo a composite are generally not a single ring but a product of several, and the exponents no longer live on one dial. A later essay is about what replaces the dial, and about a consequence for primality testing that is more than a curiosity: the largest order of a unit modulo can be much smaller than the number of units, and a composite whose orders are all small is a composite that Fermat’s test cannot see.
What a generator is for
Three uses, and each is the same observation applied differently.
Logarithms modulo a prime. Fix a generator ; then every residue is for a unique , and is the discrete logarithm. Multiplication becomes addition of logarithms, exactly as it does for ordinary logarithms, and the tables that were used for hand computation modulo a prime were logarithm tables. Computing the logarithm in the other direction — given , find — is believed to be hard, and a great deal of cryptography rests on the belief. The contrast with the exponentiation, which is a few hundred squarings, is what makes the asymmetry useful.
Deciding which residues are squares. Written as powers of a generator, the squares are exactly the even powers, so precisely half the residues are squares and the product of two non-squares is a square. Those facts are immediate from the ring and awkward from the definition, and they are what the reciprocity law is a law about.
Constructing things that need every residue once. A generator’s powers are a listing of the units with no repeats, which is what a sequence must be if it is to be used as a source of well-spread values. A linear congruential generator achieves a full period exactly when its multiplier plays the role of a generator for the relevant modulus, and the condition in that essay’s arithmetic is this theorem’s condition.
What the pictures cannot show
Every figure here is drawn at a modulus below forty, and the interest of the subject is at moduli of hundreds of digits. The rings are drawn because a ring of twelve can be seen and a ring of cannot, and everything the drawings establish is the mechanism rather than the case.
The orders are computed by walking the orbit, which is the slowest possible method and the only one that needs no theory. At the sizes drawn it is instant and it is also the reason the figures are evidence: nothing consults a formula for an order, so a residue whose order failed to divide would be reported rather than assumed away.
And the ring’s layout carries no information. The residues are placed round the circle in numerical order because some order was needed, and the walk’s shape — a star, a polygon, a tangle — is an artefact of that choice. What is real is which residues the walk visits and how many steps it takes; the prettiness is not part of the mathematics, and a different placement would produce an unrecognisable picture of the same fact.
Still open: how often a fixed base generates
The existence of a generator is settled and the behaviour of any particular base is not. Artin’s conjecture asks for the proportion of primes for which two is a generator and predicts a specific constant, about , arrived at by treating the conditions at different primes as independent. The heuristic is convincing, the constant has been computed to many places, and the statement is unproved.
What is known is conditional in a way worth noting, because it is the standard situation in this subject. Hooley showed in 1967 that the conjecture follows from the generalised Riemann hypothesis, so the question is not isolated — it is attached to the central open problem about the distribution of primes, and a proof of that would settle this as a corollary.
The other direction is the one the figures are about. The count of residues of each order is exact and elementary, and it settles existence completely for prime moduli and, with more work, for all moduli. What it cannot do is tell anybody which residue to use, and the gap between knowing something exists and being able to produce it is unusually wide here: a prime of six hundred digits has plenty of generators and finding one requires factoring a six-hundred-digit number first.
What the two theorems are each worth
Fermat’s theorem bounds and the existence theorem attains, and the difference between those two kinds of statement is worth carrying past this page.
A bound is cheap and it is what the necklace count gives: partition a set, read off a divisibility, done. Attainment needs more, and in this case it needed a fact about polynomials — that a prime modulus permits no more roots than the degree — which is a statement about the modulus rather than about counting. The extra hypothesis is visible in exactly the place where the theorem fails, which is the most satisfying way for a hypothesis to earn its place.
What the attained version buys is a change of coordinates. Once the residues are the powers of one of them, multiplication is addition, squares are even exponents, and the whole multiplicative structure is a single dial. That is a large return for one existence theorem, and it is the reason the subject bothers with primitive roots at all rather than stopping at the divisibility.
The pattern is worth naming because it recurs. A theorem that bounds a quantity usually comes from a partition — count something two ways and a divisibility falls out. A theorem that says the bound is achieved usually needs a second ingredient from somewhere else, and the second ingredient is what limits the theorem’s scope. Here the ingredient is a fact about polynomials, the scope is the moduli that are prime powers or twice one, and both the ingredient and the scope were invisible until somebody asked the stronger question.
What links here
Computed from the collection, not written here: the essays that point at this one.
Reads more easily once this is understood
Essays that name this one as worth reading first.
Shares its objects with
Essays that name at least two of the same things, and that neither author linked.
- Colourings nobody can tell apart — both name counting two ways, cyclic group, group action, orbit
- A remainder read two digits at a time — both name cyclic group, modular arithmetic, primes
- Every third coefficient — both name cyclic group, group action, modular arithmetic
- The blocks a subgroup cuts out — both name cyclic group, group action, modular arithmetic
- The symbol is the sign of a shuffle — both name counting two ways, cyclic group, modular arithmetic
- The two supplements, and where the eight comes from — both name counting two ways, modular arithmetic, primes
Named objects
A dashed tag is an object no other essay names yet.
Counting two waysCyclic groupDivisorGroup actionModular arithmeticOrbitOrderPrimes