Nobody gets stuck on this problem because the algebra is hard. Every line of the proof is a factorisation you already know. People get stuck because they try to attack and as numbers, factoring them, hunting for primes, and the numbers are the wrong thing to look at.
The whole proof is one observation: the Euclidean algorithm on the exponents produces the Euclidean algorithm on the numbers, step for step. Once you see that, the identity
stops being a fact to memorise and becomes something you can rebuild in two minutes in an exam. This guide shows the proof, a second proof by orders, and the problems where it quietly does the work.
Believe it first
Take and . Then and . Run Euclid on those: leaves remainder on division by , and , so the gcd is .
Now look at the exponents. , and . Same answer.
Look closer at that first remainder. Euclid on the exponents says , remainder . Euclid on the numbers gave remainder . The remainder on the numbers is to the remainder on the exponents, minus one. That is not a coincidence, and it is the entire proof.
The one fact you need
If divides , then divides . Write and ; then , and always divides , because
You have probably met this already. It is the same factorisation that shows if is prime then is prime: a composite exponent hands you a proper factor for free.
The proof
Take and divide: with . Split off the remainder in the exponent:
Expand the right side if you doubt it: . Now divides , so by the fact above divides . That kills the first term modulo , leaving
And a gcd does not change when you replace one number by its remainder modulo the other. So
The pair of exponents went from to , which is exactly one step of Euclid on and . Repeat. The exponents follow Euclid's algorithm all the way down until the remainder is , at which point the exponent pair is , and the numbers are and . The gcd of anything with is itself. Done.
On the example: on the exponents, and on the numbers. Every exponent on the left becomes on the right.
This is the problem in the archive, and when you write it up, the marker is looking for two things: the congruence with a reason attached, and an honest ending at remainder rather than "and so on".
A second proof, by orders
The first proof is the one to write. This one is worth knowing because it generalises to problems where Euclid has nothing to run on, and it is pure modular thinking.
Let . Then modulo we have both and . Any power of built by adding and subtracting multiples of and is therefore also . By Bézout, can be written as with (for and : ). So , and since both and are , we get . That is, divides .
The other direction is the one fact from earlier: divides both and , so divides both numbers, hence divides . Each divides the other, so they are equal.
How to spot it next time
The identity hides behind several disguises. Reach for it when you see:
- Two numbers one less than a power, same base, like and . Nothing about is special. The same proof gives for any integer .
- Repunits. with ones is , so the gcd of the repunits with and ones is the repunit with ones. The repunits with and ones share exactly .
- "Show these are coprime." Since , the numbers and are coprime exactly when and are. Take over all primes : they are pairwise coprime, so each one contributes a prime the others lack, and that is a proof there are infinitely many primes.
- An exponent that is clearly a gcd or lcm in disguise. If the answer to a question is and the inputs mention and , you now know where the came from.
What to write in the exam
Four lines are enough:
- Divide with remainder: .
- State the congruence , with the factorisation as its reason.
- Conclude the gcd is unchanged when becomes .
- Say the process is Euclid's algorithm on the exponents and finishes at .
If you can produce those four lines from memory, you do not need to remember the formula. You need to remember that exponents run Euclid too.
Related guides
- Order modulo p in olympiad number theoryThe order of a modulo p divides p - 1 and every n with a^n = 1 mod p. How to use it to pin down prime factors, with a worked proof and the traps.
- Zsigmondy's theorem: statement, exceptions and examplesZsigmondy's theorem says a^n - b^n has a prime factor no earlier a^k - b^k has, with two exceptions. The statement, the traps, and a worked problem.
- Lifting the exponent lemma explained for competitionsThe lifting the exponent lemma in one line, the p = 2 version that catches almost everyone, and the signals that tell you a contest problem wants it.
- Chinese remainder theorem in olympiad problemsThe Chinese remainder theorem for coprime moduli, how to solve a system by hand, what changes when moduli share a factor, and where olympiads use it.
- Legendre's formula for the power of a prime in n!Legendre's formula gives the exponent of a prime in n! as a sum of floors. The proof, the digit-sum form, trailing zeros, and the traps that cost marks.
Techniques in this guide
- Modular ThinkingWhen the numbers are too big, shrink the universe.
Train it on Lemma
Every technique here is taught explicitly, in order. 161 lessons, 1735 curated problems and unlimited generated practice at six difficulties. Free to start, no card.
Find your level