Lemma › Guides › Lifting the exponent lemma explained for competitions
Guide

Lifting the exponent lemma explained for competitions

18 October 2026

Lifting the exponent is not hard to learn. The statement is one line, and the proof is a page you can rebuild yourself. What goes wrong in a contest is the other two things: people apply it at p=2p = 2 with the odd-prime formula and get a confidently wrong answer, and people fail to notice that a problem wants it at all, because the problem never says "valuation".

This is the lemma explained the way competitions test it. It gives the statement once, spends most of its time on the p=2p = 2 trap, and then on recognition.

The statement

Write vp(x)v_p(x) for the exponent of the prime pp in xx: v3(54)=3v_3(54) = 3 because 54=2⋅3354 = 2 \cdot 3^3. Lifting the exponent (LTE) answers one question: what is vp(an−bn)v_p(a^n - b^n)?

For an odd prime pp with p∣a−bp \mid a - b, and pp dividing neither aa nor bb:

vp(an−bn)=vp(a−b)+vp(n).v_p(a^n - b^n) = v_p(a - b) + v_p(n).

That is the whole lemma. The exponent of pp in a huge number is the exponent in a small number plus the exponent in nn. Nothing about the size of ana^n matters.

A first example. How many times does 33 divide 427−14^{27} - 1? Here a=4a = 4, b=1b = 1, and 3∣4−1=33 \mid 4 - 1 = 3, with 33 dividing neither 44 nor 11. So v3(427−1)=v3(3)+v3(27)=1+3=4v_3(4^{27} - 1) = v_3(3) + v_3(27) = 1 + 3 = 4. You never wrote down a number with seventeen digits.

There is a plus version for odd nn. If pp is odd, p∣a+bp \mid a + b, pp divides neither aa nor bb, and nn is odd, then

vp(an+bn)=vp(a+b)+vp(n).v_p(a^n + b^n) = v_p(a + b) + v_p(n).

It is the minus version with bb replaced by −b-b, which is why nn has to be odd. For even nn it does not just change, it collapses: a≡−ba \equiv -b gives an+bn≡2bn(modp)a^n + b^n \equiv 2b^n \pmod p, which is not divisible by pp at all.

The p = 2 trap

Every LTE mistake worth worrying about lives here. For p=2p = 2, with aa and bb both odd:

The even case has an extra term, v2(a+b)−1v_2(a + b) - 1, and it is never zero, because a+ba + b is even. So the odd-prime formula is not a rough version of the right answer at p=2p = 2. It is wrong every single time nn is even.

Watch it fail. Take v2(3100−1)v_2(3^{100} - 1). The odd-prime formula says v2(2)+v2(100)=1+2=3v_2(2) + v_2(100) = 1 + 2 = 3. The real formula says v2(2)+v2(4)+v2(100)−1=1+2+2−1=4v_2(2) + v_2(4) + v_2(100) - 1 = 1 + 2 + 2 - 1 = 4. The answer is 44: 3100−13^{100} - 1 is divisible by 1616 and not by 3232.

Where does the extra term come from? From the very first factor. 32−1=(3−1)(3+1)=2⋅43^2 - 1 = (3 - 1)(3 + 1) = 2 \cdot 4, and that 3+13 + 1 already holds two factors of 22, not one. For odd pp, the sum a+ba + b is never divisible by pp when a−ba - b is, so it never shows up. For p=2p = 2, it always does.

The rule to carry into the exam: the moment you see p=2p = 2 and an even exponent, write the four-term formula. Do not try to remember which version applies. Ask whether nn is even, and if it is, a+ba + b goes in.

A contest-shaped example: the largest power of 22 dividing 51024−15^{1024} - 1. Here n=1024n = 1024 is even, so v2(5−1)+v2(5+1)+v2(1024)−1=2+1+10−1=12v_2(5 - 1) + v_2(5 + 1) + v_2(1024) - 1 = 2 + 1 + 10 - 1 = 12. The answer is 2122^{12}.

Why it is true

You will write LTE as a cited lemma, not prove it in the exam, but knowing the proof is what stops you misapplying it. It is two cases, both built on the factorisation

an−bn=(a−b)(an−1+an−2b+⋯+bn−1).a^n - b^n = (a - b)\left(a^{n-1} + a^{n-2}b + \dots + b^{n-1}\right).

It is the same identity that settles why 2n−12^n - 1 can only be prime when nn is, and that drives the gcd of 2m−12^m - 1 and 2n−12^n - 1. LTE is what you get when you ask that factorisation how many factors of pp it holds.

Case 1. Suppose pp does not divide nn. Modulo pp we have a≡ba \equiv b, so each of the nn terms in the bracket is ≡bn−1\equiv b^{n-1}, and the bracket is ≡n bn−1\equiv n \, b^{n-1}. Neither nn nor bb is divisible by pp, so the bracket is not. All the factors of pp sit in a−ba - b, and vp(an−bn)=vp(a−b)v_p(a^n - b^n) = v_p(a - b), which is the formula with vp(n)=0v_p(n) = 0.

Case 2. Suppose n=pn = p. Now the bracket has pp terms. A slightly finer count, writing a=b+kpa = b + kp and expanding each term to first order in kpkp, shows the bracket is divisible by pp exactly once, provided pp is odd. So each factor of pp in nn adds exactly one to the valuation. Apply this vp(n)v_p(n) times and Case 1 to whatever is left of nn, and the formula follows.

The condition that pp is odd is the whole p=2p = 2 story. At p=2p = 2 the bracket is a+ba + b, and for a=3a = 3, b=1b = 1 that is 44, divisible by 22 twice. That is the extra term from the last section, appearing in the proof exactly where you would expect it.

This is modular thinking at its most economical: you never compute an−bna^n - b^n, only what it looks like modulo pp and p2p^2.

When to reach for it

LTE problems rarely say "find vpv_p". They say one of these:

Here is the second signal at work. Find all positive nn with 2n∣3n−12^n \mid 3^n - 1. If nn is odd, v2(3n−1)=v2(2)=1v_2(3^n - 1) = v_2(2) = 1, so we need n≤1n \le 1, which gives n=1n = 1. If nn is even, v2(3n−1)=1+2+v2(n)−1=2+v2(n)v_2(3^n - 1) = 1 + 2 + v_2(n) - 1 = 2 + v_2(n), and we need 2+v2(n)≥n2 + v_2(n) \ge n. Since v2(n)v_2(n) grows like a logarithm and nn does not, this fails quickly: it holds at n=2n = 2 and n=4n = 4 and nowhere after. The answer is n∈{1,2,4}n \in \{1, 2, 4\}. Check the edges: 34−1=803^4 - 1 = 80 is divisible by 1616, and 36−1=7283^6 - 1 = 728 is not divisible by 6464.

Notice that the whole problem was decided by the p=2p = 2 formula. Use the odd-prime version and you get 1+v2(n)≥n1 + v_2(n) \ge n, which loses n=4n = 4.

When the hypothesis fails

LTE needs p∣a−bp \mid a - b. Often a problem hands you a prime that does not divide a−ba - b, and the fix is to raise to the order first.

Take v5(2100−1)v_5(2^{100} - 1). Since 55 does not divide 2−12 - 1, LTE does not apply as written. But 24=16≡1(mod5)2^4 = 16 \equiv 1 \pmod 5, and 44 is the smallest such exponent. So rewrite 2100−1=1625−12^{100} - 1 = 16^{25} - 1, where 5∣16−15 \mid 16 - 1. Now LTE gives v5(15)+v5(25)=1+2=3v_5(15) + v_5(25) = 1 + 2 = 3.

The other hypothesis, that pp divides neither aa nor bb, is the one people forget to check. If p∣ap \mid a and p∣bp \mid b, pull out the common power of pp first and apply LTE to what remains. Skipping that check is how a correct formula produces a wrong number.

What to do with this

Valuation arguments are a habit more than a formula. The same move of tracking one prime at a time, rather than the whole number, is what proves the harmonic sum is never an integer, where everything turns on the single term with the largest power of 22. LTE is that habit with a closed form attached.

To make it stick, take ten problems of the forms above and for each one write three lines only: which prime, which hypothesis you checked, and which formula you used, with p=2p = 2 and even nn flagged every time. The problem archive has the number theory problems linked here in full, and the daily problem posts a fresh one every day if you want to keep the recognition warm.

Related guides

Train it on Lemma

Every technique here is taught explicitly, in order. 125 lessons, 1206 curated problems and unlimited generated practice at six difficulties. Free to start, no card, and every paid plan opens with 3 free days.

Find your level