In number theory, Fermat's Last Theorem (sometimes called Fermat's conjecture, especially in older texts) states that there are no positive integers
a
,
b
,
c
,
n
{\displaystyle a,b,c,n}
with
n
>
2
{\displaystyle n>2}
such that
a
n
+
b
n
=
c
n
{\displaystyle a^{n}+b^{n}=c^{n}}
. The cases
n
=
1
{\displaystyle n=1}
and
n
=
2
{\displaystyle n=2}
have been known since antiquity to have infinitely many solutions.
The proposition was first stated as a theorem by Pierre de Fermat around 1637 in the margin of a copy of Arithmetica. Fermat wrote that "I have discovered a truly marvelous proof of this, which this margin is too narrow to contain." Although other statements claimed by Fermat without proof were subsequently proven by others and credited as theorems of Fermat (for example, Fermat's theorem on sums of two squares), Fermat's Last Theorem resisted proof, leading to doubt that Fermat ever had a correct proof. Consequently, the proposition became known as a conjecture rather than a theorem. After 358 years of effort by mathematicians, the first successful proof was released in 1994 by Andrew Wiles and formally published in 1995. It was described as a "stunning advance" in the citation for Wiles's Abel Prize award in 2016. It also proved much of the Taniyama–Shimura conjecture, subsequently known as the modularity theorem, and opened up entire new approaches to numerous other problems and mathematically powerful modularity lifting techniques.
The unsolved problem stimulated the development of algebraic number theory in the 19th and 20th centuries. For its influence within mathematics and in culture more broadly, it is among the most notable theorems in the history of mathematics.
In September 2026, Anthropic released a complete machine-checked formalization of the theorem in Lean 4. Mathematician Kevin Buzzard compiled the released code and reported that it passed Lean's comparator check.
Contents
Overview
Pythagorean origins
The Pythagorean equation,
x
2
+
y
2
=
z
2
{\displaystyle x^{2}+y^{2}=z^{2}}
, has an infinite number of positive integer solutions for
x
{\displaystyle x}
,
y
{\displaystyle y}
, and
z
{\displaystyle z}
; these solutions are known as Pythagorean triples (with the simplest example being 3, 4, 5). Around 1637, Fermat wrote in the margin of a book that the more general equation
a
n
+
b
n
=
c
n
{\displaystyle a^{n}+b^{n}=c^{n}}
had no solutions in positive integers if
Subsequent developments and solution
The special case
n
=
4
{\displaystyle n=4}
, proved by Fermat himself, is sufficient to establish that if the theorem is false for some exponent
n
{\displaystyle n}
that is not a prime number, it must also be false for some smaller
n
{\displaystyle n}
, so only prime values of
n
{\displaystyle n}
need further investigation. Over the next two centuries (1637–1839), the conjecture was proved for only the primes 3, 5, and 7, although Sophie Germain innovated and proved an approach that was relevant to an entire class of primes. In the mid-19th century, Ernst Kummer extended this and proved the theorem for all regular primes, leaving irregular primes to be analyzed individually. Building on Kummer's work and using sophisticated computer studies, other mathematicians were able to extend the proof to cover all prime exponents up to four million, but a proof for all exponents was considered exceedingly difficult or unachievable with the knowledge of the time.
Around 1955, Japanese mathematicians Goro Shimura and Yutaka Taniyama suspected a link might exist between elliptic curves and modular forms, two completely different areas of mathematics. Known at the time as the Taniyama–Shimura conjecture, it had no apparent connection to Fermat's Last Theorem. It was widely seen as significant and important in its own right, but was (like Fermat's theorem) considered completely inaccessible to proof.
Equivalent statements of the theorem
There are several alternative ways to state Fermat's Last Theorem that are mathematically equivalent to the original statement of the problem.
In order to state them, we use the following notations: let
N
{\displaystyle \mathbb {N} }
be the set of natural numbers
1
,
2
,
3
,
…
,
{\displaystyle 1,2,3,\dots ,}
let
Z
{\displaystyle \mathbb {Z} }
be the set of integers
0
,
±
1
,
±
2
,
…
,
{\displaystyle 0,\pm 1,\pm 2,\dots ,}
and let
Mathematical history
Pythagoras and Diophantus
In ancient times it was known that a triangle whose sides were in the ratio 3:4:5 would have a right angle as one of its angles. This was used in construction and later in early geometry. It was also known to be one example of a general rule that any triangle where the length of two sides, each squared and then added together (32 + 42 = 9 + 16 = 25), equals the square of the length of the third side (52 = 25), would also be a right angle triangle. This is now known as the Pythagorean theorem, and a triple of numbers that meets this condition is called a Pythagorean triple; both are named after the ancient Greek Pythagoras. Thus, a Pythagorean triple is a set of three integers (a, b, c) that satisfy the equation a2 + b2 = c2. Examples include (3, 4, 5) and (5, 12, 13). There are infinitely many such triples, and methods for generating such triples have been studied in many cultures, beginning with the Babylonians and later ancient Greek, Chinese, and Indian mathematicians.
Fermat's equation, xn + yn = zn with positive integer solutions, is an example of a Diophantine equation, named for the 3rd-century Alexandrian mathematician, Diophantus, who studied them and developed methods for the solution of some kinds of Diophantine equations. A typical Diophantine problem is to find two integers x and y such that their sum, and the sum of their squares, equal two given numbers A and B, respectively:
A
=
x
+
y
,
B
=
x
2
+
y
2
.
{\displaystyle A=x+y,\qquad B=x^{2}+y^{2}.}
Diophantus's major work is the Arithmetica, of which only a portion has survived. Fermat's conjecture of his Last Theorem was inspired while reading a new edition of the Arithmetica, that was translated into Latin and published in 1621 by Claude Bachet.
Islamic mathematics
The cubic Fermat equation x3 + y3 = z3 was studied by Abu-Mahmud Khujandi (c. 940–1000), in the period of mathematics in the medieval Islamic world. He claimed to have proven it to have no integer or rational number solutions, but his proof is now considered faulty. Another mathematician from later in the medieval Islamic period, Abdallah ibn Muhhammad ibn Abd al-Razzāq Ibn al-Khawwām (1243 – after 1324), a student of Nasir al-Din al-Tusi, published a list of open problems among which he included both the degree 3 and degree 4 cases of Fermat's last theorem.
Fermat's conjecture
A modern algebraic reformulation of
Problem II.8 of the Arithmetica asks how a given squared rational number is split into two other squares of rational numbers; in other words, for a given rational number k, it asks to find rational numbers u and v such that k2 = u2 + v2. Diophantus shows how to solve this sum-of-squares problem for k = 4, the solutions being u = 16/5 and v = 12/5.
Around 1637, Fermat wrote his Last Theorem in Latin in the margin of his copy of the Arithmetica next to Diophantus's sum-of-squares problem:
After Fermat's death in 1665, his son Clément-Samuel Fermat produced a new edition of the book (1670) augmented with his father's comments. Although not actually a theorem at the time (meaning a mathematical statement for which proof exists), the marginal note became known over time as Fermat's Last Theorem, as it was the last of Fermat's asserted theorems to remain unproved.
It is not known whether Fermat had actually found a valid proof for all exponents n, but it appears unlikely. Only one related proof by him has survived, namely for the case n = 4, as described in the section § Proofs for specific exponents.
While Fermat posed the cases of n = 4 and of n = 3 as challenges to his mathematical correspondents, such as Marin Mersenne, Blaise Pascal, and John Wallis, he never posed the general case. Moreover, in the last thirty years of his life, Fermat never again wrote of his "truly marvelous proof" of the general case, and never published it. Van der Poorten suggests that while the absence of a proof is insignificant, the lack of challenges means Fermat realised he did not have a proof; he quotes Weil as saying Fermat must have briefly deluded himself with an irretrievable idea. The techniques Fermat might have used in such a "marvelous proof" are unknown.
Wiles and Taylor's proof relies on 20th-century techniques. Fermat's proof would have had to be elementary by comparison, given the mathematical knowledge of his time.
While Harvey Friedman's grand conjecture implies that any provable theorem (including Fermat's last theorem) can be proved using only elementary function arithmetic, such a proof need be 'elementary' only in a technical sense and could involve millions of steps, and thus be far too long to have been Fermat's proof.
Proofs for specific exponents
Only one relevant proof by Fermat has survived, in which he uses the technique of infinite descent to show that the area of a right triangle with integer sides can never equal the square of an integer. His proof is equivalent to demonstrating that the equation
x
4
−
y
4
=
z
2
{\displaystyle x^{4}-y^{4}=z^{2}}
has no primitive solutions in integers (no pairwise coprime solutions). In turn, this proves Fermat's Last Theorem for the case n = 4, since the equation a4 + b4 = c4 can be written as c4 − b4 = (a2)2.
Alternative proofs of the case n = 4 were developed later by many authors.
After Fermat proved the special case n = 4, the general proof for all n required only that the theorem be established for all odd prime exponents. In other words, it was necessary to prove only that the equation an + bn = cn has no positive integer solutions (a, b, c) when n is an odd prime number. This follows because a solution (a, b, c) for a given n is equivalent to a solution for all the factors of n. For illustration, let n be factored into d and e, n = de. The general equation
a
n
+
b
n
=
c
n
Early modern breakthroughs
In the early 19th century, Sophie Germain developed several novel approaches to prove Fermat's Last Theorem for all exponents. First, she defined a set of auxiliary primes θ constructed from the prime exponent p by the equation θ = 2hp + 1, where h is any integer not divisible by three. She showed that, if no integers raised to the pth power were adjacent modulo θ (the non-consecutivity condition), then θ must divide the product xyz. Her goal was to use mathematical induction to prove that, for any given p, infinitely many auxiliary primes θ satisfied the non-consecutivity condition and thus divided xyz; since the product xyz can have at most a finite number of prime factors, such a proof would have established Fermat's Last Theorem. Although she developed many techniques for establishing the non-consecutivity condition, she did not succeed in her strategic goal. She also worked to set lower limits on the size of solutions to Fermat's equation for a given exponent p, a modified version of which was published by Adrien-Marie Legendre. As a byproduct of this latter work, she proved Sophie Germain's theorem, which verified the first case of Fermat's Last Theorem (namely, the case in which p does not divide xyz) for every odd prime exponent less than 270, and for all primes p such that at least one of 2p + 1, 4p + 1, 8p + 1, 10p + 1, 14p + 1 and 16p + 1 is prime (specially, the primes p such that 2p + 1 is prime are called Sophie Germain primes). Germain tried unsuccessfully to prove the first case of Fermat's Last Theorem for all even exponents, specifically for n = 2p, which was proved by Guy Terjanian in 1977. In 1985, Leonard Adleman, Roger Heath-Brown and Étienne Fouvry proved that the first case of Fermat's Last Theorem holds for infinitely many odd primes p.
In 1847, Gabriel Lamé outlined a proof of Fermat's Last Theorem based on factoring the equation xp + yp = zp in complex numbers, specifically the cyclotomic field based on the roots of the number 1. His proof failed, however, because it assumed incorrectly that such complex numbers can be factored uniquely into primes, similar to integers. This gap was pointed out immediately by Joseph Liouville, who later read a paper that demonstrated this failure of unique factorisation, written by Ernst Kummer.
Kummer set himself the task of determining whether the cyclotomic field could be generalized to include new prime numbers such that unique factorisation was restored. He succeeded in that task by developing the ideal numbers.
(It is often stated that Kummer was led to his "ideal complex numbers" by his interest in Fermat's Last Theorem; there is even a story often told that Kummer, like Lamé, believed he had proven Fermat's Last Theorem until Lejeune Dirichlet told him his argument relied on unique factorization; but the story was first told by Kurt Hensel in 1910 and the evidence indicates it likely derives from a confusion by one of Hensel's sources. Harold Edwards said the belief that Kummer was mainly interested in Fermat's Last Theorem "is surely mistaken". See the history of ideal numbers.)
Connection with elliptic curves
The strategy that ultimately led to a successful proof of Fermat's Last Theorem arose from the "astounding" Taniyama–Shimura–Weil conjecture, proposed around 1955—which many mathematicians believed would be near to impossible to prove, and was linked in the 1980s by Gerhard Frey, Jean-Pierre Serre and Ken Ribet to Fermat's equation. By accomplishing a partial proof of this conjecture in 1994, Andrew Wiles ultimately succeeded in proving Fermat's Last Theorem, as well as leading the way to a full proof by others of what is now known as the modularity theorem.
Around 1955, Japanese mathematicians Goro Shimura and Yutaka Taniyama observed a possible link between two apparently completely distinct branches of mathematics, elliptic curves and modular forms. The resulting modularity theorem (at the time known as the Taniyama–Shimura conjecture) states that every elliptic curve is modular, meaning that it can be associated with a unique modular form.
The link was initially dismissed as unlikely or highly speculative, but was taken more seriously when number theorist André Weil found evidence supporting it, though not proving it; as a result the conjecture was often known as the Taniyama–Shimura–Weil conjecture.
Even after gaining serious attention, the conjecture was seen by contemporary mathematicians as extraordinarily difficult or perhaps inaccessible to proof. For example, Wiles's doctoral supervisor John Coates states that it seemed "impossible to actually prove", and Ken Ribet considered himself "one of the vast majority of people who believed [it] was completely inaccessible", adding that "Andrew Wiles was probably one of the few people on earth who had the audacity to dream that you can actually go and prove [it]."
In 1984, Gerhard Frey noted a link between Fermat's equation and the modularity theorem, then still a conjecture. If Fermat's equation had any solution (a, b, c) for exponent p > 2, then it could be shown that the semi-stable elliptic curve (now known as a Frey-Hellegouarch)
y
2
=
Wiles's general proof
Ribet's proof of the epsilon conjecture in 1986 accomplished the first of the two goals proposed by Frey. Upon hearing of Ribet's success, Andrew Wiles, an English mathematician with a childhood fascination with Fermat's Last Theorem, and who had worked on elliptic curves, decided to commit himself to accomplishing the second half: proving a special case of the modularity theorem (then known as the Taniyama–Shimura conjecture) for semistable elliptic curves.
Wiles worked on that task for six years in near-total secrecy, covering up his efforts by releasing prior work in small segments as separate papers and confiding only in his wife. His initial study suggested proof by induction, and he based his initial work and first significant breakthrough on Galois theory before switching to an attempt to extend horizontal Iwasawa theory for the inductive argument around 1990–91 when it seemed that there was no existing approach adequate to the problem. However, by mid-1991, Iwasawa theory also seemed to not be reaching the central issues in the problem. In response, he approached colleagues to seek out any hints of cutting-edge research and new techniques, and discovered an Euler system recently developed by Victor Kolyvagin and Matthias Flach that seemed "tailor made" for the inductive part of his proof. Wiles studied and extended this approach, which worked. Since his work relied extensively on this approach, which was new to mathematics and to Wiles, in January 1993 he asked his Princeton colleague, Nick Katz, to help him check his reasoning for subtle errors. Their conclusion at the time was that the techniques Wiles used seemed to work correctly.
By mid-May 1993, Wiles was ready to tell his wife he thought he had solved the proof of Fermat's Last Theorem, and by June he felt sufficiently confident to present his results in three lectures delivered on 21–23 June 1993 at the Isaac Newton Institute for Mathematical Sciences. Specifically, Wiles presented his proof of the Taniyama–Shimura conjecture for semistable elliptic curves; together with Ribet's proof of the epsilon conjecture, this implied Fermat's Last Theorem. However, it became apparent during peer review that a critical point in the proof was incorrect. It contained an error in a bound on the order of a particular group. The error was caught by several mathematicians refereeing Wiles's manuscript including Katz (in his role as reviewer), who alerted Wiles on 23 August 1993.
The error would not have rendered his work worthless: each part of Wiles's work was highly significant and innovative by itself, as were the many developments and techniques he had created in the course of his work, and only one part was affected. However, without this part proved, there was no actual proof of Fermat's Last Theorem. Wiles spent almost a year trying to repair his proof, initially by himself and then in collaboration with his former student Richard Taylor, without success. By the end of 1993, rumours had spread that under scrutiny, Wiles's proof had failed, but how seriously was not known. Mathematicians were beginning to pressure Wiles to disclose his work whether it was complete or not, so that the wider community could explore and use whatever he had managed to accomplish. But instead of being fixed, the problem, which had originally seemed minor, now seemed very significant, far more serious, and less easy to resolve.
Subsequent developments
The full Taniyama–Shimura–Weil conjecture was finally proved by Diamond (1996), Conrad et al. (1999), and Breuil et al. (2001) who, building on Wiles's work, incrementally chipped away at the remaining cases until the full result was proved. The now fully proved conjecture became known as the modularity theorem.
Several other theorems in number theory similar to Fermat's Last Theorem also follow from the same reasoning, using the modularity theorem. For example: no cube can be written as a sum of two coprime nth powers, n ≥ 3. (The case n = 3 was already known by Euler.)
Formal verification
In 2024, a project led by Kevin Buzzard at Imperial College London began working toward a formalization of Fermat's Last Theorem in the Lean proof assistant. Funded by the Engineering and Physical Sciences Research Council through 2029, the project was designed to formalize a modern route to the theorem while developing supporting material in Lean's mathematical library, mathlib.
On 4 September 2026, Anthropic released an end-to-end formalization in Lean 4. Anthropic reported that Claude worked largely autonomously for 11 days and produced about 13 million lines of Lean, proving 30,300 intermediate theorems, of which about 29,500 were used in the final proof. The formalization follows the exposition by Henri Darmon, Fred Diamond, and Richard Taylor of the Frey–Serre–Ribet–Wiles–Taylor–Wiles argument. Its modularity argument covers prime exponents p ≥ 17; previously formalized results for odd regular primes supply the remaining odd prime cases needed in the reduction.
The released repository states that the proof was checked from scratch by the Lean kernel. The Lean comparator verified that the final theorem matches mathlib's statement of Fermat's Last Theorem and uses no additional axioms, and the same environment was also accepted by nanoda, an independent Lean kernel written in Rust, which checked 1,052,234 declarations without errors. Buzzard compiled the code base and ran comparator, reporting that it passed. Completion of the formalization also marked the final theorem on Freek Wiedijk's list of 100 formalization challenges.
Relationship to other problems and generalizations
Fermat's Last Theorem considers solutions to the Fermat equation:
a
n
+
b
n
=
c
n
{\displaystyle a^{n}+b^{n}=c^{n}}
with positive integers a, b, and c and an integer n greater than 2. There are several generalizations of the Fermat equation to more general equations that allow the exponent n to be a negative integer or rational, or to consider three different exponents.
Generalized Fermat equation
The generalized Fermat equation generalizes the statement of Fermat's last theorem by considering positive integer solutions a, b, c, m, n, and k satisfying
a
m
+
b
n
=
c
k
.
{\displaystyle a^{m}+b^{n}=c^{k}.}
In particular, the exponents m, n, and k need not be equal, whereas Fermat's last theorem considers the case m = n = k.
The Beal conjecture states that there are no solutions to the generalized Fermat equation in positive integers a, b, c, m, n, k with a, b, and c being pairwise coprime and all of m, n, k being greater than 2.
The Fermat–Catalan conjecture generalizes Fermat's last theorem with the ideas of the Catalan conjecture. The conjecture states that the generalized Fermat equation has only finitely many solutions (a, b, c, m, n, k) with distinct triplets of values (am, bn, ck), where a, b, c are positive coprime integers and m, n, k are positive integers satisfying
1
m
+
1
n
+
1
k
<
Inverse Fermat equation
When we allow the exponent n to be the reciprocal of an integer; that is, n = 1/m for some integer m, we have the inverse Fermat equation
a
1
m
+
b
1
m
=
c
1
m
.
{\displaystyle a^{\frac {1}{m}}+b^{\frac {1}{m}}=c^{\frac {1}{m}}.}
All solutions of this equation were computed by Hendrik Lenstra in 1992. In the case in which the mth roots are required to be real and positive, all solutions are given by
a
=
r
s
m
b
=
r
t
m
c
=
r
(
s
+
Rational exponents
For the Diophantine equation
a
n
m
+
b
n
m
=
c
n
m
{\displaystyle a^{\frac {n}{m}}+b^{\frac {n}{m}}=c^{\frac {n}{m}}}
with n not equal to 1, Bennett, Glass, and Székely proved in 2004 for n > 2, that if n and m are coprime, then there are integer solutions if and only if 6 divides m, and a1/m, b1/m, and c1/m are different complex 6th roots of the same real number.
Negative integer exponents
All primitive integer solutions (that is, those with no prime factor common to all of a, b, and c) to the optic equation a−1 + b−1 = c−1 can be written as
a
=
m
k
+
m
2
b
=
m
k
+
k
2
c
=
m
k
{\displaystyle {\begin{aligned}a&=mk+m^{2}\\b&=mk+k^{2}\\c&=mk\end{aligned}}}
for positive, coprime integers m, k.
The case n = −2 also has an infinitude of solutions, and these have a geometric interpretation in terms of right triangles with integer sides and an integer altitude to the hypotenuse. All primitive solutions to a−2 + b−2 = d−2 are given by
a
=
(
v
2
−
u
abc conjecture
The abc conjecture roughly states that if three positive integers a, b and c (hence the name) are coprime and satisfy a + b = c, then the radical d of abc is usually not much smaller than c. In particular, the abc conjecture in its most standard formulation implies Fermat's last theorem for n that are sufficiently large. The modified Szpiro conjecture is equivalent to the abc conjecture and therefore has the same implication. An effective version of the abc conjecture, or an effective version of the modified Szpiro conjecture, implies Fermat's Last Theorem outright.
Prizes and incorrect proofs
In 1816, and again in 1850, the French Academy of Sciences offered a prize for a general proof of Fermat's Last Theorem. In 1857, the academy awarded 3,000 francs and a gold medal to Kummer for his research on ideal numbers, although he had not submitted an entry for the prize. Another prize was offered in 1883 by the Academy of Brussels.
In 1908, the German industrialist and amateur mathematician Paul Wolfskehl bequeathed 100,000 gold marks—a large sum at the time—to the Göttingen Academy of Sciences to offer as a prize for a complete proof of Fermat's Last Theorem. On 27 June 1908, the academy published nine rules for awarding the prize. Among other things, these rules required that the proof be published in a peer-reviewed journal; the prize would not be awarded until two years after the publication; and that no prize would be given after 13 September 2007, roughly a century after the competition was begun. Wiles collected the Wolfskehl prize money, then worth $50,000, on 27 June 1997. In March 2016, Wiles was awarded the Norwegian government's Abel Prize worth €600,000 for "his stunning proof of Fermat's Last Theorem by way of the modularity conjecture for semistable elliptic curves, opening a new era in number theory".
Prior to Wiles's proof, thousands of incorrect proofs were submitted to the Wolfskehl committee, amounting to roughly 10 feet (3.0 meters) of correspondence. In the first year alone (1907–1908), 621 attempted proofs were submitted, although by the 1970s, the rate of submission had decreased to roughly 3–4 attempted proofs per month. According to some claims, Edmund Landau tended to use a special preprinted form for such proofs, where the location of the first mistake was left blank to be filled by one of his graduate students. According to F. Schlichting, a Wolfskehl reviewer, most of the proofs were based on elementary methods taught in schools, and often submitted by "people with a technical education but a failed career". In the words of mathematical historian Howard Eves, "Fermat's Last Theorem has the peculiar distinction of being the mathematical problem for which the greatest number of incorrect proofs have been published."
In popular culture
The popularity of the theorem outside science has led to it being described as achieving "that rarest of mathematical accolades: A niche role in pop culture."
Arthur Porges' 1954 short story "The Devil and Simon Flagg" features a mathematician who bargains with the Devil that the latter cannot produce a proof of Fermat's Last Theorem within twenty-four hours.
In the 1989 Star Trek: The Next Generation episode "The Royale", Captain Picard states that the theorem is still unproven in the 24th century. The proof was released five years after the episode originally aired. In a 1998 episode of The Simpsons, "The Wizard of Evergreen Terrace", Homer Simpson writes the equation 398712 + 436512 = 447212 on a blackboard, which appears to be a counterexample to Fermat's Last Theorem. The equation is wrong, but it appears to be correct if entered in a calculator with 10 significant figures.
Simon Singh's Fermat's Last Theorem (1997) became the first mathematics book to become a number-one seller in the United Kingdom. Singh's documentary The Proof won a BAFTA award in 1997.




