aⁿ + bⁿ − cⁿ
Relative gap
Matching digits
c
  • aⁿ + bⁿ
  • cⁿ
Power Value Power − sum

More about Fermat's Last Theorem

Fermat's Last Theorem

Enter positive integers a, b and an exponent n and compare aⁿ + bⁿ with cⁿ. For n = 2 the equation is Pythagoras and has infinitely many solutions. For every integer n above 2, Fermat's Last Theorem says there are none. The arithmetic is exact, so a gap of 1 is really 1, even when the powers have dozens of digits. Enter positive integers a and b and an exponent n, or pick an example. The sum is compared with c to that power. The difference is exact, and your last input is kept in this browser.

How it works

  1. Enter a, b and an exponent n of 2 or more, or pick an example.
  2. Compare the sum with the nearest c, or type a c of your own.
  3. Read the exact difference, how many leading digits agree, and where the sum sits between the neighboring powers.

The theorem

Fermat's Last Theorem says that aⁿ + bⁿ = cⁿ has no solutions in positive integers when the exponent n is an integer greater than 2. For n = 2 it is Pythagoras, and 3² + 4² = 5² is the smallest solution. Pierre de Fermat wrote the claim in 1637 in the margin of his copy of Diophantus, adding that his proof would not fit there. No proof of his for the general case was ever found. Andrew Wiles proved the theorem in 1995.

Near misses

A sum of two powers can land just beside another power. 9³ + 10³ = 1,729 and 12³ = 1,728, so the two sides differ by 1. 13⁵ + 16⁵ = 1,419,869 and 17⁵ = 1,419,857, a difference of 12. In The Simpsons, a blackboard shows 3,987¹² + 4,365¹² = 4,472¹². The two sides agree on the first 10 digits, 63,976,656,34…, but the sum is larger by about 1.21 × 10³³, a relative gap of about 1.89 × 10⁻¹¹. A display that keeps only those 10 digits can round them to the same number. Closeness is not a solution.

Frequently asked questions

Does this prove the theorem?

No. It checks the numbers you enter, with exact integer arithmetic, so a gap of 1 is really 1 and not a rounding error. The proof that no solution exists for any exponent above 2 is Wiles's, from 1995, and it is far beyond what a calculator can do.

Why do squares work when higher powers do not?

For n = 2 the equation is Pythagoras, and there are infinitely many solutions. Two integers m > k > 0 give a = m² − k², b = 2mk and c = m² + k²: m = 2 and k = 1 give 3, 4, 5. No identity of that kind produces positive integers for an exponent above 2. Fermat himself proved n = 4, Euler n = 3, and Wiles every remaining exponent.

Are my numbers sent anywhere?

No. The powers are calculated in your browser, and your last inputs stay in this browser's local storage.

Ready to try it?

Open PictorX in your browser — no install, no credit card required to start.

Go to Editor