HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →
Live examsInternational live exams are comingTell us which exam you want first. Timed practice papers are open now.See what is coming →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Space Science and Astronomy
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
  1. Problems
  2. /Numbers of the form 2ᵏ - 1 share factors in a neat way…
AdvancedMathematicsHigh School (11–12)Number TheoryConceptualNumericalOlympiad

Numbers of the form 2ᵏ - 1 share factors in a neat way…

StemPy LabContributed by StemPy Lab

Try it on paper first. A hint, the key idea and the worked solution are here when you need them.

Numbers of the form 2k−12^k - 12k−1 share factors in a neat way. For example gcd⁡(26−1,24−1)=gcd⁡(63,15)=3=22−1\gcd(2^6 - 1, 2^4 - 1) = \gcd(63, 15) = 3 = 2^2 - 1gcd(26−1,24−1)=gcd(63,15)=3=22−1.

  1. For m>n≥1m > n \ge 1m>n≥1, show that 2m−1=2m−n(2n−1)+(2m−n−1)2^m - 1 = 2^{m-n}(2^n - 1) + (2^{m-n} - 1)2m−1=2m−n(2n−1)+(2m−n−1).
  1. Deduce that gcd⁡(2m−1,2n−1)=gcd⁡(2n−1,2m−n−1)\gcd(2^m - 1, 2^n - 1) = \gcd(2^n - 1, 2^{m-n} - 1)gcd(2m−1,2n−1)=gcd(2n−1,2m−n−1), and then prove that gcd⁡(2m−1,2n−1)=2gcd⁡(m,n)−1\gcd(2^m - 1, 2^n - 1) = 2^{\gcd(m, n)} - 1gcd(2m−1,2n−1)=2gcd(m,n)−1.
  1. Find gcd⁡(235−1,221−1)\gcd(2^{35} - 1, 2^{21} - 1)gcd(235−1,221−1) as a number.

Check your answer

Work it out on paper, then type your number. The answer itself stays hidden.

Need a reminder? The key ideaShowHide

Euclidean algorithm: gcd⁡(a,b)=gcd⁡(b,r)\gcd(a, b) = \gcd(b, r)gcd(a,b)=gcd(b,r) where a=bq+ra = bq + ra=bq+r. Bezout: ax+by=gcd⁡(a,b)ax + by = \gcd(a, b)ax+by=gcd(a,b) for some integers xxx, yyy, and ax+by=cax + by = cax+by=c is solvable exactly when gcd⁡(a,b)∣c\gcd(a, b) \mid cgcd(a,b)∣c.

The worked solution

Check an answer or open a hint to unlock the worked solution.

Have you tried it?

Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, go through the solution one step at a time, and check each step against your own.

Step 1. Part (a). 2m−n(2n−1)+2m−n−1=2m−2m−n+2m−n−1=2m−12^{m-n}(2^n - 1) + 2^{m-n} - 1 = 2^m - 2^{m-n} + 2^{m-n} - 1 = 2^m - 12m−n(2n−1)+2m−n−1=2m−2m−n+2m−n−1=2m−1.

Step 2. The first claim of part (b). By part (a), 2m−12^m - 12m−1 minus a multiple of 2n−12^n - 12n−1 is 2m−n−12^{m-n} - 12m−n−1. The subtracting rule gives gcd⁡(2m−1,2n−1)=gcd⁡(2n−1,2m−n−1)\gcd(2^m - 1, 2^n - 1) = \gcd(2^n - 1, 2^{m-n} - 1)gcd(2m−1,2n−1)=gcd(2n−1,2m−n−1).

Step 3. The formula. Use strong induction on m+nm + nm+n. If m=nm = nm=n, both sides are 2m−12^m - 12m−1. Otherwise, say m>nm > nm>n. By Step 2 the HCF equals gcd⁡(2n−1,2m−n−1)\gcd(2^n - 1, 2^{m-n} - 1)gcd(2n−1,2m−n−1), a pair with a smaller exponent sum. By the induction hypothesis this is 2gcd⁡(n,m−n)−12^{\gcd(n, m - n)} - 12gcd(n,m−n)−1. And gcd⁡(n,m−n)=gcd⁡(m,n)\gcd(n, m - n) = \gcd(m, n)gcd(n,m−n)=gcd(m,n). Proof complete.

Step 4. Part (c). gcd⁡(35,21)=7\gcd(35, 21) = 7gcd(35,21)=7, so the HCF is 27−1=1272^7 - 1 = 12727−1=127.

Answer: gcd⁡(235−1,221−1)=127\gcd(2^{35} - 1, 2^{21} - 1) = 127gcd(235−1,221−1)=127.

What if? The proof works for any base b≥2b \ge 2b≥2: gcd⁡(bm−1,bn−1)=bgcd⁡(m,n)−1\gcd(b^m - 1, b^n - 1) = b^{\gcd(m, n)} - 1gcd(bm−1,bn−1)=bgcd(m,n)−1.

Log in to save this for later
← All Problems
← A cyclist's wheel has a circumference of 1547 mm and a measuring wheel has a circumference of 560…A cook has a 7-litre jug, an 11-litre jug, a tap and a large pot… →
More onNumber Theory

Discussion (0)

Log in to join the discussion.

Loading…

More on this topic

  1. The triangular numbers are 1, 3, 6, 10, …, where the nth one is (n(n + 1))/2…Advanced
  2. Prove that the equation x³ + y³ + z³ = n has no solution in integers when n leaves remainder 4 or 5…Advanced
  3. Find every triple of positive integers a ≤ b ≤ c with 1/a + 1/b + 1/c = 1, and prove that there are…Advanced
  4. Find all pairs of positive integers (x, y) with x² - y² = 945…Hard
  5. A teacher wants a list of every primitive Pythagorean triple whose hypotenuse is less than 100…Advanced
All problems on this topic →