Claude Formalizes Fermat's Last Theorem in 11 Days
Claude formalized Fermat's Last Theorem using 13M lines of Lean code in just 11 days.
By @admin

Claude Formalizes Fermat's Last Theorem in Just 11 Days: AI Reaches a New Mathematics Milestone
For more than 350 years, one mathematical problem remained among the most famous challenges in mathematics.
It is known as Fermat's Last Theorem.
The statement itself looks surprisingly simple:
There are no positive whole numbers (a), (b), and (c) that satisfy:
[
a^n+b^n=c^n
]
when (n) is greater than 2.
French mathematician Pierre de Fermat wrote this statement in the margin of a mathematics book around 1637. He also claimed to have discovered a remarkable proof, but he never left behind a complete proof that could be verified.
Generations of mathematicians attempted to solve the problem.
In 1995, British mathematician Andrew Wiles published the first accepted proof, with an important contribution from Richard Taylor. It was a major achievement that required sophisticated mathematics developed over centuries.
Now, more than three decades later, artificial intelligence has reached another remarkable milestone involving the same theorem.
Anthropic, the company behind Claude, announced on September 4, 2026, that Claude had completed the first end-to-end computer-checked formalization of Fermat's Last Theorem using the Lean programming language.
The project took just 11 days of largely autonomous work.
During that time, Claude produced approximately 13 million lines of Lean code and proved 29,500 intermediate theorems used in the final proof.
But there is an important distinction.
Claude did not discover Fermat's Last Theorem. Andrew Wiles had already proved it in 1995.
Instead, Claude converted the existing mathematical proof into a form that a computer could check step by step.
This may sound like a technical difference, but it could have major consequences for the future of mathematics and scientific research.
Let's understand what actually happened.
1. What is Fermat's Last Theorem?
To understand the achievement, we first need to understand the mathematical problem.
Fermat's Last Theorem is based on a simple-looking equation:
[
a^n+b^n=c^n
]
For the special case where (n=2), there are many positive integer solutions.
For example:
[
3^2+4^2=5^2
]
Because:
[
9+16=25
]
This is a familiar Pythagorean triple.
But Fermat's Last Theorem states that when the exponent is greater than 2, there are no positive whole-number solutions.
For example, there are no positive integers that satisfy:
[
a^3+b^3=c^3
]
or the corresponding equation for any larger integer exponent.
The statement is easy to understand, but proving that no possible positive integer solutions exist is extraordinarily difficult.
Fermat wrote his famous claim in 1637. For centuries, mathematicians tried to establish a complete proof.
Many partial results were discovered, but a complete proof remained out of reach.
In 1995, Andrew Wiles finally published a proof using advanced mathematical techniques involving elliptic curves and modular forms.
His achievement became one of the most celebrated events in modern mathematics.
2. What exactly did Claude accomplish?
Anthropic's announcement was not about discovering a new mathematical theorem.
It was about something called mathematical formalization.
Mathematical proofs are usually written for human readers.
A mathematician can write a proof that says a particular result follows from an earlier theorem, without explicitly spelling out every tiny logical step.
Human readers with the required mathematical knowledge can understand those missing details.
But computers need much more precise instructions.
A computer cannot simply assume that an omitted mathematical step is obvious. Every logical connection must be represented in a formal language that a proof-checking system understands.
This is where Claude's achievement becomes important.
Anthropic used Claude to translate the existing mathematical argument into Lean code.
The resulting code allowed the Lean proof assistant to verify the logical structure of the proof mechanically.
In other words, Claude helped turn a lengthy mathematical argument into a computer-checkable proof.
The final result was not simply an AI-generated explanation saying that Fermat's Last Theorem was true.
It was a formal proof that could be checked by software.
3. What is Lean, and why is it important?
Lean is a programming language and proof assistant designed for formal mathematics.
It allows mathematicians and developers to express mathematical definitions, statements and proofs in a precise format.
Think of the difference between asking someone to explain why a mathematical answer is correct and asking them to show every logical step in a format that can be independently checked.
That is the basic idea behind Lean.
A conventional mathematical paper might contain hundreds of pages of reasoning.
A Lean formalization represents the mathematics in a structured language where the proof assistant checks whether the steps follow logically.
If a required logical connection is missing or incorrect, the system will not accept the proof.
This makes proof assistants valuable for checking complicated mathematical arguments.
However, writing a formal proof is extremely difficult.
A human mathematician might understand a proof perfectly but still need years to translate it into Lean.
The difficulty is not simply writing code. It is expressing complicated mathematical concepts, definitions, assumptions and logical dependencies in a format the system can verify.
Anthropic's achievement demonstrates that AI agents can now help automate a substantial part of this process.
4. Eleven days, 13 million lines of code
The numbers behind the project are remarkable.
According to Anthropic, Claude worked largely autonomously for 11 days to complete the formalization.
The project produced:
- Approximately 13 million lines of Lean code.
- 29,500 intermediate theorems used in the final proof.
- Around 30,300 intermediate theorem proofs generated during the effort.
- A complete computer-checked formalization of Fermat's Last Theorem.
The final proof was more than five times the size of Mathlib, the principal community library of formalized mathematics used with Lean.
Anthropic also reported that the project consumed approximately six billion output tokens from an internal research model.
An important detail is that the project did not rely on one AI agent working independently from beginning to end.
Dozens of Claude agents collaborated on different parts of the mathematical problem.
Some agents worked on definitions and intermediate results. Others attempted to prove particular mathematical statements. The results were then connected to progressively more difficult parts of the proof.
This allowed the system to divide a massive mathematical challenge into smaller tasks.
Instead of asking one AI model to solve everything in a single attempt, the project used a coordinated group of agents.
5. How did multiple AI agents work together?
One of the most interesting parts of this achievement was the workflow used to coordinate the agents.
Initially, some attempts struggled.
Anthropic explained that agents sometimes lost track of the overall project state and had difficulty coordinating their work effectively.
The team then used Prove2Me, an open collaborative platform for formalizing mathematics.
This platform helped agents manage the dependencies between mathematical statements and divide the larger project into smaller tasks.
It provided three particularly important capabilities.
First: A structured theorem dependency graph.
The platform maintained a directed graph showing how different mathematical statements depended on one another.
This helped agents identify which smaller results needed to be completed before attempting more difficult theorems.
Second: Faster compilation and resource management.
Lean proofs can become computationally expensive, especially when dealing with enormous mathematical projects.
The system separated theorem statements and their proofs into different files, helping agents work more efficiently.
Third: Search and reuse of mathematical results.
Agents could search for existing theorem statements and reuse completed work instead of repeatedly attempting the same mathematical problem.
This is important because a large proof is not simply a collection of independent equations.
Every major result depends on smaller mathematical results.
The agents needed a way to coordinate those dependencies and combine their work into one complete proof.
This is where the project moved beyond ordinary AI-assisted coding and towards coordinated AI research.
6. Did Claude actually prove Fermat's Last Theorem?
This is where we need to be precise.
Andrew Wiles and Richard Taylor had already established the mathematical result in the 1990s.
Claude's achievement was to formalize the existing proof.
The work followed a mathematical exposition by Henri Darmon, Fred Diamond and Richard Taylor, building on earlier contributions from mathematicians and formalization projects.
Anthropic also acknowledged the work of Kevin Buzzard and the Imperial College London Fermat's Last Theorem formalization project.
The important breakthrough was that Claude completed the formalization end to end.
Lean checked the resulting proof using its three standard axioms.
Anthropic also used a comparator to confirm that the formalized theorem statement matched Mathlib's own statement of Fermat's Last Theorem.
Mathematician Kevin Buzzard reviewed the completed proof and commented on the significance of the achievement.
So, this was not simply Anthropic asking people to trust a chatbot's mathematical answer.
The formal proof could be checked by the proof assistant.
However, formal verification of the encoded proof should not be confused with independently discovering the underlying mathematics.
The human mathematical work that made the original theorem possible remains fundamental to this achievement.
7. Why is this important for the future of mathematics?
One of the biggest problems in advanced mathematics is verification.
When researchers publish complicated mathematical proofs, other mathematicians need to examine their arguments and check whether every step is correct.
For particularly difficult results, this process can take months or even years.
A mathematical proof may contain hundreds of pages, numerous assumptions and connections between different areas of mathematics.
Finding a small error can require enormous effort.
Formalization could help reduce this burden.
If a mathematical argument is translated into Lean, a proof assistant can check the encoded logical steps.
This does not eliminate the need for human mathematical understanding or review, but it can provide a powerful additional layer of verification.
It could also help researchers identify mistakes in existing mathematical work.
Imagine a future in which researchers publish a conventional mathematical paper alongside a formal Lean version of the proof.
Other mathematicians could read the explanation, while the proof assistant checks the formal argument.
This could make mathematical verification more scalable.
As AI systems become capable of producing more mathematical work, the ability to verify that work becomes increasingly important.
8. What does this mean for students and developers?
This achievement is also interesting for people learning programming, mathematics and artificial intelligence.
For developers, Lean represents a different way of thinking about software.
Traditional programming focuses on telling a computer how to perform a task.
Formal verification focuses on expressing what must be true and checking whether the required logical conditions are satisfied.
AI systems that can work with both programming languages and formal mathematical systems could open new opportunities.
Students interested in mathematics and computer science can explore:
- Lean and formal theorem proving.
- Mathematical logic.
- AI-assisted programming.
- Multi-agent systems.
- Automated reasoning.
- Formal verification of software.
For AI developers, the project also demonstrates the value of breaking large problems into smaller tasks.
A coordinated group of specialised agents, supported by a system that tracks dependencies and verifies results, can tackle work that would be difficult to complete through a single prompt.
This approach could become useful in scientific computing, software verification, engineering and research.
9. What should we expect next?
Anthropic's achievement does not mean AI can now independently solve every mathematical problem.
The project relied on existing mathematical knowledge, an established proof strategy, human guidance at a high level, a formalization platform and the work of earlier mathematicians.
The proof was also extremely large. Anthropic acknowledged that it was likely much longer than necessary.
Some of the code came from unsuccessful attempts, demonstrating that the process involved trial and error rather than a perfect sequence of solutions.
But the important development is that AI systems can now contribute to the formal verification of mathematics at a scale that previously seemed extremely difficult to achieve.
This could change how researchers approach complex proofs.
Instead of spending years manually translating an existing mathematical argument into a formal system, researchers may increasingly use AI agents to handle much of that work.
And once more mathematical knowledge is available in machine-checkable form, researchers could build new work on top of it with greater confidence.
Conclusion: AI is moving beyond answering mathematical questions
For years, most people experienced AI as a tool that answered questions, generated explanations and solved individual coding problems.
Now, AI systems are beginning to participate in much larger technical workflows.
Anthropic's Fermat's Last Theorem project demonstrates how multiple AI agents can collaborate, manage complex dependencies, write enormous amounts of formal code and produce a result that a proof assistant can verify.
It does not erase Andrew Wiles's achievement or replace centuries of mathematical research.
Instead, it builds on that work and demonstrates a new way to use AI in mathematics.
The real significance is not that Claude discovered a 350-year-old theorem.
It is that a task expected to require years of human formalization work was completed in 11 days using a coordinated AI workflow.
And this raises an exciting question for the future:
If AI can now help formalize one of mathematics' most famous proofs, what other areas of scientific research could become dramatically faster with AI agents?
---
Official sources and further reading
1. Anthropic — Formalizing Fermat's Last Theorem: https://www.anthropic.com/research/formalizing-fermats-last-theorem
2. Complete Lean proof — Anthropic GitHub repository: https://github.com/anthropics/fermat
3. Nature — Anthropic AI formalizes Fermat's Last Theorem: https://www.nature.com/articles/d41586-026-02822-9