The panel on Moonshots with Peter Diamandis was arguing about whether governments could slow AI down when one speaker broke off to read something that had just crossed his feed: Anthropic, he said, had just formalized Fermat's last theorem in 13 million lines.
"Really? Wow," came the reply. "29,000 theorems on the way. Math is cooked."
Someone reached for the joke that Fermat set up himself when he wrote in the margin of his book that he had a proof he had no room to write down: "This is obviously left as an exercise to the reader." Another panelist noted that the mathematics was not in doubt — "thanks to Andrew Wiles, we did have the proof" — but that "formalizing large unwieldy proofs has been a holy grail for at least the formalization community."
That distinction is the whole story, and it is worth slowing down on before the numbers.
Not a new proof — a proof a machine can check
Andrew Wiles proved Fermat's Last Theorem across what a panelist put at roughly 300 pages of dense mathematics. Human referees checked it the way mathematics has always been checked: experts read it.
Formalizing a proof means something different. You rewrite every step in a language a computer can verify — here, Lean, a proof assistant in which each claim must follow from previously established claims by rules the software enforces. Nothing can be waved through as obvious. That is why formalizing big proofs has been a long-standing goal and a long-standing slog: a page of professional mathematics can expand into thousands of lines, because every step a human reader would grant has to be spelled out.
So Anthropic's agents did not discover anything about Fermat's equation. According to Anthropic's September 4 research report, they rendered an existing argument — following a simplified presentation of Wiles's proof — into a form Lean would accept. On the podcast this got compressed to "Anthropic proved it in 13 million lines of code," with one speaker losing track of the figure a moment later: "three million lines of code or 30 million lines of code or something."
What the run actually consumed
The report's own accounting is more specific. Dozens of agents, driven by an internal research model Anthropic describes as roughly comparable to Fable 5.1, completed the successful run in eleven days and burned through approximately six billion output tokens — tokens being the chunks of text, typically a word or less, that a model produces.
Along the way the agents proved 30,300 intermediate theorems. The final artifact uses 29,500 of them across about 13 million lines. The gap matters: several hundred results were established and then not needed, which is what work at this scale looks like from the inside. Humans were not absent either. Anthropic says people supplied occasional high-level mathematical direction — pointing the effort at the right sub-goal rather than writing the Lean.
The bookkeeping was the breakthrough
The more interesting part of the report is why earlier attempts failed. They lost track of project state: agents could not reliably tell what had already been proved, what depended on what, or where their own earlier work had gone. Those runs contributed roughly 7% of the final non-boilerplate lines.
The successful effort ran on an internal tool Anthropic calls Prove2Me, which did three unglamorous things. It tracked which theorems depended on which others, so the project had a live map of its own structure. It separated the statement of a theorem from its proof, so that a statement could be compiled and used by other agents before anyone had finished proving it — the mathematical equivalent of agreeing on an interface while the implementation is still being written. And it let agents search what already existed and reuse it, rather than reproving results their colleagues had finished hours earlier.
None of that gives agents unlimited memory. It gives one project a shared, searchable record of its own state — a narrower fix, and one that worked for a task with a clean formal structure.
How anyone knows the result is right
A 13-million-line artifact is unreadable by any human, which raises the obvious question of trust. Two checks carry it. Lean verified the proof using its three standard axioms — the small set of foundational assumptions the system is built on, with nothing extra smuggled in. And a comparator checked that the statement the agents had actually proved matched Mathlib's statement of Fermat's Last Theorem. Mathlib is Lean's community mathematics library, and that second check guards against the failure mode where a system proves something subtly weaker than the theorem everyone wanted.
"Narrow it back down"
Back on the podcast, one speaker asked to make a narrow point before the panel returned to regulation, crediting the observation to a fellow panelist. When you run these models at scale, he said, with hundreds or thousands of them running concurrently, everything breaks loose: "It's all chaos, but it can actually refine back down to a gem."
Fermat, in his telling, is that gem: a single checked object you can build on, pulled out of an enormous churn of machine output. His warning was aimed at people about to hit the same wall in ordinary work. Anyone starting to explore with the bigger models, he said, will quickly realize the system is "producing way more than they can read, they can think about." The skill is getting from that to something concrete: "Just narrow it back down and get some concrete answer out the other side that you can then build on. Be clear about your objective that you're shooting for."
The Fermat run had an unusually clear objective, and a referee that could not be charmed. Lean either accepts the file or it does not. Most business problems do not come with a compiler attached — which is the part of the example that does not transfer, and the part worth noticing when the next headline arrives with a bigger number in it.