Olympiad Number Theory III: Exponential Diophantine Equations

Study Sheet

Olympiad Number Theory III: Exponential Diophantine Equations

Powers of two, difference of squares, Catalan-type equations, and the parity–valuation reflex

Equations in Exponents

Tip
Divide out the smallest power, then look at parity

2x+2y=2z2^x + 2^y = 2^z: dividing by 2min⁡(x,y)2^{\min(x,y)} leaves 1+2k=2m1 + 2^k = 2^m, forcing k=0k = 0; so the solutions are exactly (x,x,x+1)(x, x, x+1). In general, comparing pp-adic valuations of both sides is the first move.

An exponential equation is a statement about valuations: the side with the smaller valuation must be matched exactly. After dividing out, one side is a unit modulo pp and the other is a power of pp — usually a contradiction unless an exponent is 00. The same reflex settles 3x+3y=3z3^x + 3^y = 3^z, 2x+3y=5z2^x + 3^y = 5^z (mod small numbers), and most "find all positive integers" equations of contest size.

Tip
Difference of squares and difference of powers

m2−n2=2km^2 - n^2 = 2^k splits as (m−n)(m+n)(m-n)(m+n) with both factors powers of 22 of the same parity; 2n+1=m22^n + 1 = m^2 becomes 2n=(m−1)(m+1)2^n = (m-1)(m+1), two powers of 22 differing by 22, so n=3n = 3; 3x−2y=13^x - 2^y = 1 needs xx even (mod 88) and then (3x/2−1)(3x/2+1)=2y(3^{x/2} - 1)(3^{x/2} + 1) = 2^y gives (2,3)(2, 3) besides (1,1)(1, 1).

Factoring is the second reflex. The pattern "two powers of pp whose difference is small" has finitely many solutions, all tiny — that is the elementary heart of Catalan's equation xa−yb=1x^a - y^b = 1 (Mihăilescu proved the general case; the powers-of-22 and 33 cases are exercises). Always finish with the small cases you excluded along the way (here y≤2y \le 2).

Tip
Growth arguments and ab=baa^b = b^a
t12345678max at t = eln 2/2 = ln 4/4y = (ln t)/t
Equal heights at t = 2 and t = 4: a chord of the graph can only straddle the peak at e.

ab=baa^b = b^a with a<ba < b has the unique solution (2,4)(2, 4): ln⁡tt\tfrac{\ln t}{t} increases on (0,e)(0, e) and decreases after, so one of the two is ≤2\le 2.

Taking logarithms, ab=baa^b=b^a says ln⁡aa=ln⁡bb\tfrac{\ln a}{a}=\tfrac{\ln b}{b}: two points at the same height on the graph of g(t)=ln⁡ttg(t)=\tfrac{\ln t}{t}. Since g′(t)=1−ln⁡tt2g'(t)=\tfrac{1-\ln t}{t^2}, gg increases on (0,e)(0,e) and decreases on (e,∞)(e,\infty), so a horizontal chord with a<ba<b has a<e<ba<e<b, i.e. a∈{1,2}a\in\{1,2\}. a=1a=1 gives 1=b1=b, impossible; a=2a=2 gives b2=2bb^2=2^b, which fails at b=3b=3 (9≠89\ne8) and holds at b=4b=4, and 2b>b22^b>b^2 for b≥5b\ge5 (induction: 2b+1=2⋅2b>2b2≥(b+1)22^{b+1}=2\cdot2^b>2b^2\ge(b+1)^2). The general lesson: when modular arithmetic and factoring both fail, compare growth rates, state the monotonicity precisely (with the derivative), then check the finitely many small cases by hand — the proof is incomplete without both halves.

Side note
The bounding checklist

Every "find all positive integer solutions" problem is solved by some mix of: valuations/parity, a modulus that kills a residue class (mod 3,4,7,8,9,163, 4, 7, 8, 9, 16), factoring into coprime pieces, size comparison (squeezing between consecutive squares or powers), and descent. Write which one you are using at each step; graders award partial credit per correctly justified reduction.

Try it
Try it: squeeze

Show that n2+n+1n^2 + n + 1 is never a perfect square for n≥1n \ge 1.

Show the answer

Since n2<n2+n+1<n2+2n+1=(n+1)2n^2 < n^2 + n + 1 < n^2 + 2n + 1 = (n+1)^2 for n≥1n \ge 1, it lies strictly between consecutive squares.

Exponential Equations: Choosing the Modulus

Tip
Choose the modulus from the orders

In an equation such as ax±by=cza^x\pm b^y=c^z, reduce modulo an mm for which the powers involved have short periods — the period of ax mod ma^x\bmod m is ord⁡m(a)\operatorname{ord}_m(a). Useful facts:

  • mod 88: 3x∈{1,3}3^x\in\{1,3\}, 5x∈{1,5}5^x\in\{1,5\}, 7x∈{1,7}7^x\in\{1,7\}; mod 33: 2x≡(−1)x2^x\equiv(-1)^x, 5x≡(−1)x5^x\equiv(-1)^x; mod 44: odd aa has ax≡1a^x\equiv1 or aa;
  • a modulus that divides a power of 22 (or 33, ...) kills that term — but only once its exponent is large enough;
  • the usual goal is a parity of an exponent, which makes a difference of squares factor.

Modulo mm, each power axa^x is periodic in xx with period ord⁡m(a)\operatorname{ord}_m(a), so the equation becomes a finite table of residues. When the orders are small the table is tiny and either contradicts itself or pins an exponent's residue — most usefully its parity. An even exponent turns c2w−byc^{2w}-b^y into (cw−by/2)(cw+by/2)(c^w-b^{y/2})(c^w+b^{y/2}), and a product of two factors equal to a prime power forces both to be powers of that prime, which is usually the end. Every reduction "mod 2k2^k" or "mod 3k3^k" assumes the corresponding exponent is at least kk; the smaller exponents are separate cases to check by hand.

Example
Worked: 3x−2y=73^x-2^y=7

Find all nonnegative integers x,yx,y with 3x−2y=73^x-2^y=7. (folklore)

Step 1 — small yy first: y=0y=0 gives 3x=83^x=8, impossible; y=1y=1 gives 3x=93^x=9, so x=2x=2; y=2y=2 gives 3x=113^x=11, impossible.

Step 2 — for y≥3y\ge3, reduce mod 88: 3x≡7(mod8)3^x\equiv7\pmod8. But powers of 33 mod 88 alternate 1,3,1,3,…1,3,1,3,\dots, never 77. So the only solution is (x,y)=(2,1)(x,y)=(2,1).

How to find it. A power of 22 disappears modulo a power of 22, leaving a condition on 3x3^x alone; mod 88 is the smallest modulus where 3x3^x has only two residues. The price of the reduction is the list of small yy, which must be checked separately.

Example
Worked: USAJMO 2011 Problem 1

Find all positive integers nn such that 2n+12n+2011n2^n+12^n+2011^n is a perfect square. (USAJMO 2011/1)

Step 1 — n=1n=1: 2+12+2011=2025=4522+12+2011=2025=45^2.

Step 2 — even n≥2n\ge2: modulo 33, 2n≡12^n\equiv1, 12n≡012^n\equiv0 and 2011n≡1n=12011^n\equiv1^n=1, so the sum is ≡2(mod3)\equiv2\pmod3; squares are 00 or 1 mod 31\bmod3.

Step 3 — odd n≥3n\ge3: modulo 44, 2n≡02^n\equiv0, 12n≡012^n\equiv0 and 2011n≡3n≡32011^n\equiv3^n\equiv3, so the sum is ≡3(mod4)\equiv3\pmod4; squares are 00 or 1 mod 41\bmod4. So n=1n=1 is the only answer.

How to find it. Test small cases — n=1n=1 works and n=2n=2 does not — then look for a modulus in which the parity of nn changes the residue: mod 33 sees 2n=(−1)n2^n=(-1)^n, mod 44 sees 2011n=(−1)n2011^n=(-1)^n. One modulus per parity class finishes it.

Example
Worked: 3x+4y=5z3^x+4^y=5^z

Find all positive integers x,y,zx,y,z with 3x+4y=5z3^x+4^y=5^z. (classic)

Step 1 — mod 33: 0+1≡(−1)z0+1\equiv(-1)^z, so zz is even; write z=2wz=2w.

Step 2 — now the equation factors: 3x=52w−22y=(5w−2y)(5w+2y)3^x=5^{2w}-2^{2y}=(5^w-2^y)(5^w+2^y). Both factors are powers of 33, and their difference 2y+12^{y+1} is not divisible by 33, so the smaller one is 303^0: 5w−2y=15^w-2^y=1 and 5w+2y=3x5^w+2^y=3^x.

Step 3 — mod 33 on 5w=2y+15^w=2^y+1: (−1)w≡(−1)y+1(-1)^w\equiv(-1)^y+1. The right side is 2≡−12\equiv-1 or 00, and the left side is ±1\pm1, so (−1)y=1(-1)^y=1 and (−1)w=−1(-1)^w=-1: yy is even and ww is odd.

Step 4 — if y≥3y\ge3, then mod 88: 5w≡15^w\equiv1, which needs ww even — a contradiction. So y≤2y\le2 and yy is even: y=2y=2, 5w=55^w=5, w=1w=1, z=2z=2, and 3x=5+4=93^x=5+4=9 gives x=2x=2. The only solution is (2,2,2)(2,2,2): 9+16=259+16=25.

How to find it. The answer 32+42=523^2+4^2=5^2 is a Pythagorean triple, which suggests even exponents; mod 33 produces the one parity you need to factor. After factoring, "two powers of 33 whose difference is prime to 33" leaves no room, and mods 33 and 88 finish the remaining equation 5w=2y+15^w=2^y+1.

Side note
Where it goes wrong: the modulus assumed a large exponent

A write-up of 3x−2y=73^x-2^y=7: "Mod 88, 2y≡02^y\equiv0, so 3x≡73^x\equiv7, which is impossible since 3x∈{1,3}3^x\in\{1,3\}. Hence no solutions."

But (x,y)=(2,1)(x,y)=(2,1) is a solution: 9−2=79-2=7. The step "2y≡0(mod8)2^y\equiv0\pmod8" holds only for y≥3y\ge3; for y∈{0,1,2}y\in\{0,1,2\} the power of 22 is 1,2,41,2,4, not 00. Every reduction that makes a term vanish carries a hidden lower bound on an exponent, and the cases below that bound must be checked by hand — here they contain the whole answer.

Try it
Try it: two moduli, then factor

Find all positive integers x,yx,y with 2x−3y=72^x-3^y=7.

Show the answer

If y=1y=1, 2x=102^x=10 is impossible. So y≥2y\ge2, and mod 99: 2x≡72^x\equiv7. Powers of 22 mod 99 cycle 2,4,8,7,5,12,4,8,7,5,1 with period 66, so x≡4(mod6)x\equiv4\pmod6. Then mod 77 (where 22 has order 33 and x≡1(mod3)x\equiv1\pmod3): 2x≡22^x\equiv2, so 3y≡2−7≡2(mod7)3^y\equiv2-7\equiv2\pmod7. Powers of 33 mod 77 cycle 3,2,6,4,5,13,2,6,4,5,1, so y≡2(mod6)y\equiv2\pmod6; in particular x=2ux=2u and y=2vy=2v are both even. Now (2u−3v)(2u+3v)=7(2^u-3^v)(2^u+3^v)=7, so 2u−3v=12^u-3^v=1 and 2u+3v=72^u+3^v=7: 2u=42^u=4, 3v=33^v=3. The only solution is (x,y)=(4,2)(x,y)=(4,2): 16−9=716-9=7.

Lifting the Exponent in Equations

Theorem
Lifting the exponent (LTE)
n4812246y = nv₂(3ⁿ − 1)
The valuation grows like log n, the line y = n like n: the dots reach the line only at n = 1, 2, 4.

Let pp be an odd prime with p∣a−bp\mid a-b and p∤abp\nmid ab. Then for every n≥1n\ge1

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

and for odd nn with p∣a+bp\mid a+b: vp(an+bn)=vp(a+b)+vp(n)v_p(a^n+b^n)=v_p(a+b)+v_p(n). For p=2p=2 and odd a,ba,b: v2(an−bn)=v2(a−b)v_2(a^n-b^n)=v_2(a-b) if nn is odd, and v2(an−bn)=v2(a−b)+v2(a+b)+v2(n)−1v_2(a^n-b^n)=v_2(a-b)+v_2(a+b)+v_2(n)-1 if nn is even.

Two lemmas give it; write Sn=an−bna−b=an−1+an−2b+⋯+bn−1S_n=\tfrac{a^n-b^n}{a-b}=a^{n-1}+a^{n-2}b+\cdots+b^{n-1}. If p∤np\nmid n, then Sn≡nan−1≢0(modp)S_n\equiv na^{n-1}\not\equiv0\pmod p because b≡ab\equiv a: the valuation does not grow. If n=pn=p, put b=a+tb=a+t with p∣tp\mid t; then bi≡ai+iai−1t(modp2)b^i\equiv a^i+ia^{i-1}t\pmod{p^2}, so Sp≡pap−1+ap−2t⋅p(p−1)2≡pap−1(modp2)S_p\equiv pa^{p-1}+a^{p-2}t\cdot\tfrac{p(p-1)}2\equiv pa^{p-1}\pmod{p^2}, using that pp is odd. So a factor pp in the exponent adds exactly one to the valuation. Writing n=pkmn=p^km with p∤mp\nmid m and applying the second lemma kk times and the first once gives the formula. For p=2p=2 the step n=2n=2 is a2−b2=(a−b)(a+b)a^2-b^2=(a-b)(a+b), which adds v2(a+b)≥1v_2(a+b)\ge1 rather than 11 — the source of the extra term. The figure shows the p=2p=2 case for 3n−13^n-1: 11 at odd nn and 2+v2(n)2+v_2(n) at even nn.

Example
Worked: when does 2n2^n divide 3n−13^n-1?

Find all positive integers nn such that 2n∣3n−12^n\mid3^n-1. (folklore)

Step 1 — odd nn: v2(3n−1)=v2(3−1)=1v_2(3^n-1)=v_2(3-1)=1, so only n=1n=1 works.

Step 2 — even nn: v2(3n−1)=v2(2)+v2(4)+v2(n)−1=2+v2(n)v_2(3^n-1)=v_2(2)+v_2(4)+v_2(n)-1=2+v_2(n). We need 2+v2(n)≥n2+v_2(n)\ge n.

Step 3 — v2(n)≤log⁡2nv_2(n)\le\log_2n, and 2+log⁡2n<n2+\log_2n<n for n≥5n\ge5 (n=5n=5: 2+log⁡25<52+\log_25<5, and the left side grows more slowly afterwards). So n≤4n\le4; among even nn, n=2n=2 (v2(8)=3≥2v_2(8)=3\ge2) and n=4n=4 (v2(80)=4≥4v_2(80)=4\ge4) work. The answer is n∈{1,2,4}n\in\{1,2,4\}.

How to find it. "pnp^n divides something to the nn-th power" is a valuation question, and LTE turns the valuation into vp(n)v_p(n) plus a constant. Logarithmic against linear growth leaves only small cases.

Example
Worked: IMO 1990 Problem 3
0123456−1 ≡ 6 is never reached
Multiplying by 2 mod 7 cycles 1 → 2 → 4 → 1, so 2ⁿ + 1 is never divisible by 7.

Find all integers n>1n>1 such that n2n^2 divides 2n+12^n+1. (IMO 1990/3)

Step 1 — 2n+12^n+1 is odd, so nn is odd. Let pp be the least prime factor of nn. From 2n≡−12^n\equiv-1 we get 22n≡12^{2n}\equiv1, so ord⁡p(2)\operatorname{ord}_p(2) divides gcd⁡(2n,p−1)\gcd(2n,p-1). Every prime factor of nn is at least pp, so gcd⁡(n,p−1)=1\gcd(n,p-1)=1 and gcd⁡(2n,p−1)∣2\gcd(2n,p-1)\mid2. Hence p∣22−1=3p\mid2^2-1=3: p=3p=3.

Step 2 — LTE with p=3∣2+1p=3\mid2+1 and nn odd: v3(2n+1)=v3(3)+v3(n)=1+v3(n)v_3(2^n+1)=v_3(3)+v_3(n)=1+v_3(n). The condition n2∣2n+1n^2\mid2^n+1 needs 2v3(n)≤1+v3(n)2v_3(n)\le1+v_3(n), so v3(n)=1v_3(n)=1: n=3mn=3m with 3∤m3\nmid m.

Step 3 — suppose m>1m>1 and let qq be the least prime factor of mm, so q≥5q\ge5. As before ord⁡q(2)\operatorname{ord}_q(2) divides gcd⁡(2n,q−1)\gcd(2n,q-1); the only prime factor of nn below qq is 33, and it appears once, so gcd⁡(2n,q−1)∣6\gcd(2n,q-1)\mid6 and q∣26−1=63q\mid2^6-1=63, i.e. q=7q=7.

Step 4 — but 7∤2n+17\nmid2^n+1 for every nn: the powers of 22 mod 77 are 1,2,41,2,4, never −1≡6-1\equiv6 (the figure). So m=1m=1 and n=3n=3; indeed 9∣99\mid9.

How to find it. "nn divides an±1a^n\pm1" is attacked through the least prime factor of nn, whose order is squeezed by gcd⁡(2n,p−1)\gcd(2n,p-1). After the smallest prime is identified, LTE decides its exact power, and the next-smallest prime is squeezed the same way.

Example
Worked: xp+yp=pzx^p+y^p=p^z

Let pp be an odd prime. Find all positive integers x,y,zx,y,z with gcd⁡(x,y)=1\gcd(x,y)=1 and xp+yp=pzx^p+y^p=p^z. (folklore)

Step 1 — pp odd gives x+y∣xp+yp=pzx+y\mid x^p+y^p=p^z, so x+y=pkx+y=p^k with k≥1k\ge1 (as x+y≥2x+y\ge2). Then p∤xp\nmid x: otherwise p∣yp\mid y too, against gcd⁡(x,y)=1\gcd(x,y)=1.

Step 2 — LTE for sums (p∣x+yp\mid x+y, exponent pp odd): vp(xp+yp)=vp(x+y)+vp(p)=k+1v_p(x^p+y^p)=v_p(x+y)+v_p(p)=k+1. So xp+yp=pk+1=p(x+y)x^p+y^p=p^{k+1}=p(x+y).

Step 3 — size: by the power-mean inequality xp+yp≥2(x+y2)px^p+y^p\ge2\left(\tfrac{x+y}2\right)^p, so 21−p(x+y)p≤p(x+y)2^{1-p}(x+y)^p\le p(x+y), i.e. (x+y)p−1≤p⋅2p−1(x+y)^{p-1}\le p\cdot2^{p-1}. With x+y≥px+y\ge p this gives pp−2≤2p−1p^{p-2}\le2^{p-1}. That holds for p=3p=3 (3≤43\le4) and fails for p=5p=5 (125>16125>16) and, since pp−2≥5p−2>2p−1p^{p-2}\ge5^{p-2}>2^{p-1}, for every larger prime.

Step 4 — so p=3p=3 and (x+y)2≤12(x+y)^2\le12; x+yx+y is a power of 33 at least 22, so x+y=3x+y=3: {x,y}={1,2}\{x,y\}=\{1,2\}, and 1+8=9=321+8=9=3^2. The solutions are p=3p=3 with (x,y,z)=(1,2,2)(x,y,z)=(1,2,2) and (2,1,2)(2,1,2).

How to find it. A sum of pp-th powers equal to a power of pp: the factor x+yx+y is forced to be a power of pp, LTE says the full sum has only one more factor of pp, and then the sum is far too small compared with its pp-th powers. Valuations give an exact equation; size finishes it.

Side note
Where it goes wrong: LTE outside its hypotheses

Two tempting computations. "v2(32−1)=v2(3−1)+v2(2)=2v_2(3^2-1)=v_2(3-1)+v_2(2)=2" — but 32−1=83^2-1=8 has v2=3v_2=3. "v3(26−1)=v3(2−1)+v3(6)=0+1=1v_3(2^6-1)=v_3(2-1)+v_3(6)=0+1=1" — but 26−1=632^6-1=63 has v3=2v_3=2.

The first applies the odd-prime formula at p=2p=2; for p=2p=2 and even nn the correct formula has the extra term v2(a+b)−1v_2(a+b)-1, here v2(4)−1=1v_2(4)-1=1, giving 33. The second ignores the hypothesis p∣a−bp\mid a-b: 3∤2−13\nmid2-1. The repair is to first pass to a power where the hypothesis holds: 3∣22−13\mid2^2-1, so v3(26−1)=v3(43−1)=v3(4−1)+v3(3)=2v_3(2^6-1)=v_3(4^3-1)=v_3(4-1)+v_3(3)=2. Before quoting LTE, write down pp, aa, bb and check p∣a−bp\mid a-b, p∤abp\nmid ab and the parity of pp.

Try it
Try it: a corollary

Find all positive integers x,yx,y with 3x=2xy+13^x=2^xy+1.

Show the answer

The equation says 2x∣3x−12^x\mid3^x-1 with quotient yy. By the worked example this forces x∈{1,2,4}x\in\{1,2,4\}, and then y=3x−12xy=\tfrac{3^x-1}{2^x}: x=1x=1 gives y=1y=1, x=2x=2 gives y=84=2y=\tfrac84=2, x=4x=4 gives y=8016=5y=\tfrac{80}{16}=5. The solutions are (1,1)(1,1), (2,2)(2,2), (4,5)(4,5).