What Happened When AI Was Let Loose on a 350‑Year‑Old Math Problem
Claude formalised Fermat’s Last Theorem in 11 days, generating 13 million lines of code. We can’t read it. We can’t understand it. But Lean says it’s true.

Late at night. Tianyi Peng refreshed his monitoring dashboard.
Dozens of green nodes lit up across a vast dependency graph. Each node was a theorem the Lean proof assistant had just verified. Three days earlier, the count had been zero. Now nearly thirty thousand nodes glowed in a solid patch.
He got up to refill his water. When he came back, seven more had lit up.
Eleven days later, the formal proof of Fermat's Last Theorem rolled off the silicon assembly line. Kevin Buzzard had believed this would take years of concerted effort from the entire mathematical community. On the morning the news broke, Buzzard wrote four words on social media:
"FLT: Anthropic has beaten me to it."
I. The Ghost in the Margin
In 1637, the French mathematician Pierre de Fermat scribbled a note in the margin of Diophantus's Arithmetica. He claimed to have discovered a marvellous proof. The margin, he said, was too narrow to contain it.
That sentence tormented mathematics for three hundred and fifty years.
In 1908, a German prize of 100,000 gold marks was offered for a proof of Fermat's Last Theorem. In the first year alone, 621 submissions arrived, all wrong. For decades, amateur proofs flooded mathematical journals until editors developed standard rejection templates.
Then, in 1993, Andrew Wiles announced his proof at Cambridge. The news spread worldwide. The media swarmed. The New York Times headline read: "Math Problem, Finally Solved."
But the story did not end there.
Months later, reviewers found a gap in Wiles's proof. He spent nearly a year patching it. At one point he believed the entire approach might be beyond rescue. In September 1994, almost in despair, he found the fix. The final proof was published in 1995.
Wiles's paper is 129 pages. For a top number theorist, reading and understanding every detail takes months. Even so, the human reading of a proof relies on trust—trust that the author did not skip vital steps, trust that the reader's brain correctly fills in all those "clearly" and "obviously" passages.
This is why a specialised branch of mathematics exists: formal verification.
Formal verification does something simple and deeply counter‑human. It translates the proof written for mathematicians into a formal language that a computer can check step by step. Lean does exactly that. Its statement of Fermat's Last Theorem is just one line of code:
lean
theorem fermat_last_theorem (n : ℕ) (hn : 3 ≤ n) (a b c : ℕ) (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : a ^ n + b ^ n ≠ c ^ nBehind that line lies a complete reconstruction of dozens of layers of mathematical theory. Every road must be paved. Every brick fired.
People had proposed doing this as early as the 2000s. In 2024, Professor Buzzard at Imperial College formally launched a community project, prepared for a long siege.
Then, in September 2026, Tianyi Peng released his Claude agents into that battlefield.
II. Dawn of the Swarm
The initial experiments were chaotic.
When Peng turned dozens of Claude agents loose on the formalisation task, he expected them to divide and conquer. Instead, the agents worked at cross‑purposes. Two agents proved the same lemma simultaneously. Another began deriving an upper‑level theorem while its lower dependencies were undefined. Worse, as runtime stretched, the agents gradually lost track of the global state. They forgot what they had already proved and had no idea what to do next.
The problem was not the reasoning ability of any single agent. Claude could write Lean code, understand mathematical structures, and even discover its own proof paths. The problem was coordination. Dozens of agents running in parallel, information overlapping, contexts contaminating each other—the entire system degenerated into "too many cooks."
Peng took a different approach.
He built a system called Prove2Me. In essence, it was a giant dependency graph—a directed acyclic graph where each node was a theorem or lemma to be proved, and the edges represented dependencies: node B could only start after node A was finished.
This graph became the "common brain" for all agents.
Now each agent no longer needed to remember the state of the entire project. It had only one job: pick a node from the graph whose predecessors were all completed but which had not yet been proved, prove it, and write the result back. The system maintained the state centrally. Agents did not communicate directly, but only through this graph.
Chaos vanished.
The dozens of agents became assembly‑line workers, each focused on the single node in front of it. A group of agents defined mathematical objects at the bottom layer. Another group proved intermediate lemmas. A third group derived complex theorems at the top. Nodes lit up faster and faster. The green region on the dependency graph spread like a water stain.
The final tally: the project proved 30,300 intermediate theorems in total. The final proof directly used about 29,500 of them. Less than 3% of the intermediate results were discarded. For a fully automated AI‑generated proof system, that is efficient.
The efficiency itself is a clue. Prove2Me not only solved the "what to do" problem; it also solved the "what not to do" problem. Agents never wasted compute on already‑proved nodes, because the graph guided them to the only correct next step.
III. 13 Million Lines and $300,000
The code volume is startling.
Claude generated about 13 million lines of Lean code to formalise Fermat's Last Theorem.
Lean's foundational mathematics library, Mathlib, is the work of years. It is less than one‑fifth of that size. In 11 days, Claude wrote more than five times the accumulated code of all human mathematical formalisation efforts.
Not "slightly more." Five times.
The consumption is starker. The entire project used about 6 billion output tokens. Peng used an internal Anthropic research model, roughly equivalent to the publicly available Claude Fable 5.1. At Fable 5.1's pricing ($50 per million output tokens), the output‑token cost alone came to $300,000. That does not include input tokens, communication redundancy between multiple agents, or the vast amounts of intermediate code generated and discarded.
With that money, you could hire a small team of top postdocs for a full year. The team would take roughly three years to complete a project of the same scale. The AI compressed that time by a factor of 100, at the cost of an electricity bill.
Cost is not the issue. Time is.
There is a subtle twist. If you convert the AI's "overtime" into the equivalent of human wages, $300,000 is expensive, but far less than the total salary of a human team. The AI does not take holidays, does not get sick, does not miss deadlines, and does not suffer emotional breakdowns when reviewers raise objections.
The future of mathematical formalisation may become a simple arithmetic problem: is this theorem worth spending tens of thousands of dollars to let the AI run?
IV. Buzzard's Response
Kevin Buzzard's "beat me to it" was so brief that it almost did not read as a mathematician's public statement.
Buzzard is one of the most central advocates of the Lean community. Under his organisation at Imperial College, the FLT formalisation project had already reached a considerable depth. They had published an 86‑page Blueprint—not a paper, but an engineering plan, detailing every layer of dependency from elementary number theory up to the top of Wiles's proof.
Their progress was steady. Community collaboration, open source, papers published one after another. By normal expectations, the project would take years.
Then the AI covered the entire remaining distance in 11 days.
Buzzard's response contained no trace of sourness. In follow‑up posts he even analysed the quality of Claude's proof in detail, calling it "surprisingly solid." But the complex emotion behind "beat me to it" is unmistakable. Anyone who has worked on a long‑term project and seen someone else, using a completely different method, reach the finish line first will understand.
It was not envy. It was the silence of a craftsman watching a steam engine in the early Industrial Revolution.
Buzzard wrote in another post: "The challenge has now changed. We need to learn how to work with these machines, rather than trying to outrun them."
V. The Black Box of Truth
Anthropic emphasised one point repeatedly in its announcement:
"Claude did not discover a new proof of Fermat's Last Theorem."
What it did was formalisation—translation of Wiles's proof into a form that Lean could check. That is "translation," not "creation."
But that translation created a new problem.
Wiles's proof is 129 pages. That is something humans can read, teach, and reproduce on a blackboard. Claude's proof is 13 million lines of code. No human can ever read it from beginning to end. We know it is true—Lean's kernel verified every line. But we also cannot "understand" it in any meaningful sense.
This marks an epistemological turning point.
Before AI, the truth of mathematics rested on a combination of peer review and internal logical closure. A proof was accepted because a group of top experts spent time reading it, understanding it, and confirming each step. Now we have an "encapsulated truth"—we know it passed formal verification, but no one can independently retrace the entire path with their own mind.
The situation resembles the AI "god move" in Go. A human can see where the stone was placed, but cannot fathom the strategic intent behind a hundred subsequent moves. The difference is that Go is empirical—whether a move is correct can ultimately be judged by win or loss. A mathematical proof is purely logical. If the chain is too long for any human to reproduce independently, can we still say "we understand it"?
The original purpose of formalisation was to eliminate the loopholes of human intuition. But when a proof grows beyond human cognitive bandwidth, we have merely transferred trust. We trust the compiler, the compute, the Prove2Me system. If one day the Lean kernel is found to have a subtle type‑theoretic bug, or Prove2Me's state graph harbours a logical deadlock, will the 13‑million‑line edifice of truth come crashing down?
This is not panic. It is a structural problem. It points to a reality that is approaching: AI‑generated knowledge will increasingly exist in a form that we cannot personally verify, but must trust the system.
VI. The Mathematician's New Role
Back to that late night. As Peng watched the nodes light up one by one, what was he thinking?
In interviews he said little that was sentimental. He mentioned only one detail: "We failed several times early on. The agents could each solve problems, but overall progress stalled. After we switched to Prove2Me, the rhythm fell into place."
That sounds like an engineer reviewing a system optimisation. But if you zoom out, it is an organisational revolution—from craft workshop to assembly line.
Old model: a mathematician (or a team) conceives the proof from beginning to end, writes Lean code by hand, debugs repeatedly.
New model: a researcher designs the dependency graph, configures the agent cluster parameters, monitors node status, handles abnormally terminated jobs.
Old model's core skills: mathematical intuition and logical exposition. New model's core skills: problem decomposition and system scheduling.
It recalls the predicament of textile workers during the first Industrial Revolution. The work did not disappear; it changed. When the steam engine could spin in an hour what used to take a week, spinners no longer needed to spin by hand—but they did need to learn to operate machines, maintain them, and design more efficient production lines.
Similarly, when AI can accomplish in 11 days what once took humans years, the mathematician's function will drift in two directions:
Top‑level designers. Break a large problem into a suitable dependency graph, judge which parts are amenable to AI brute‑force search and which require human intuition for direction.
Proof compressors. The AI produced 13 million lines. Humans will want to compress that back into a 129‑page paper. This "reverse engineering" may prove harder than the original proof.
Buzzard alluded to the second possibility in a comment: "Future papers might look like this: the author uses AI to generate a formal proof, then writes an 'executive summary' explaining why it works."
It sounds plausible. But the gap between an "executive summary" and the proof itself is exactly the cognitive boundary we are crossing right now.
VII. Fermat's Silence
If Fermat really did have that marvellous proof, he probably never imagined that, more than three centuries later, a swarm of silicon‑based digital ghosts would fill the void with a method so clumsy and so vast.
13 million lines of code. 6 billion tokens. A $300,000 compute bill. 59,800 failed proof attempts.
Clumsy. Inelegant. Unreadable.
But it passed Lean's check.
In a sense, Claude's success is the first time in the history of mathematics that a proof has been confirmed without relying on human understanding. We have a complete, machine‑verified proof in hand, and we can never personally walk through every step.
That is unsettling. It is also exciting.
Because Claude only formalised Wiles's proof—a truth already discovered by humans. The next step, when AI begins to search, within Lean's framework, for proofs that no human has yet discovered, will present a different scenario. The AI will hand us a verified proof that no human can a priori comprehend.
At that point, the core definition of a "mathematician" might face its deepest restructuring in three hundred years.
Peng wrote one final sentence in his internal post‑mortem, never publicly released but recounted by those who read it:
"We proved an ancient theorem. But more importantly, we proved something else: when faced with a sufficiently complex mathematical problem, humans can choose to build machines that think for us."
Fermat's marginal note—"the margin is too narrow to contain it"—has finally been filled.
But it was not a human hand that filled it.
About the Creator
Jin
Writer of reamstories
https://reamstories.com/jin
Enjoyed the story? Support the Creator.
Subscribe for free to receive all their stories in your feed. You could also become a paid subscriber, letting them know you appreciate their work.
Comments
There are no comments for this story
Be the first to respond and start the conversation.