{"slug": "how-much-did-proving-the-riemann-hypothesis-cost", "title": "How much did proving the Riemann Hypothesis cost?", "summary": "A back-of-the-envelope analysis estimates that recreating Levent Alpöge's Claude-written Lean proof of the Riemann Hypothesis — 1.4 GiB, 175,190 files and 17,373,992 lines — would cost between $6,140.03 and $165,870.36 in API output and reasoning tokens, depending on model and assumptions. The lowest figure assumes a one-shot 614,002,830-token output on Sonnet 5.5, while the highest adds estimated reasoning tokens and a 2x agentic file-editing overhead on Fable 5.2. The author cautions that the estimates ignore input tokens, cache writes and reads, Anthropic's marginal GPU cost, and the internal, presumably larger model Alpöge actually used.", "body_md": "# [How much did proving the Riemann Hypothesis cost?](#how-much-did-proving-the-riemann-hypothesis-cost)\n\nAs neither Levent Alpöge nor Anthropic have shared details on the compute costs of developing [Alpöge's Claude-written proof\nof the Riemann Hypothesis](https://en.wikipedia.org/wiki/Alp%C3%B6ge's_proof_of_the_Riemann_hypothesis), I\nwanted to do some basic back-of-the-envelope estimates.\n\nThe Lean proof itself is 1.4 GiB (unzipped), 175 190 files and a total of 17 373 992 lines.\n\nIf you or I wanted to recreate this proof with Claude Code, how much would it cost?\n\n## [Estimate 1: Just output tokens](#estimate-1-just-output-tokens)\n\nLet's start off simple, and make the assumption that our Claude session managed to one-shot it, outputting *nothing* but the completed\nproof. Using [Anthropic's token counting API](https://platform.claude.com/docs/en/build-with-claude/token-counting), we can see that\nthis would cost:\n\n| Model | Output tokens | API Cost | \n|---|---|---|\n| Sonnet 5.5 | 614 002 830 | $6 140.03 | \n| Opus 5.5 | 614 002 830 | $12 280.06 | \n| Fable 5.2 | 614 002 830 | $24 560.11 | \n| Mythos 5.2 | 614 002 830 | $24 560.11 | \n| Mythos 5 | 614 002 830 | $30 700.14 | \n\n(Note: I'm leaving the output tokens column, even though all of those models apparently use the same tokenizer, just in case I ever get around to adding some non-Anthropic models.)\n\n## [Estimate 2: Output + estimated reasoning](#estimate-2-output-estimated-reasoning)\n\n[Artificial Analysis' Token Use table](https://artificialanalysis.ai/models/claude-fable-5-2#token-use) gives us empirical ratios\nbetween reasoning and output tokens, based on whatever mix of tasks they've selected. Unfortunately they don't have data on Mythos<sup>[1](#1)</sup>.\n\nIf we assume max reasoning, we get:\n\n| Model | Output tokens | Reasoning tokens | API Cost | \n|---|---|---|---|\n| Sonnet 5.5 | 614 002 830 | 1 602 829 176 | $22 168.32 | \n| Opus 5.5 | 614 002 830 | 1 399 405 538 | $40 268.17 | \n| Fable 5.2 | 614 002 830 | 1 459 376 619 | $82 935.18 | \n\n## [Estimate 3: Adjusted output + estimated reasoning](#estimate-3-adjusted-output-estimated-reasoning)\n\nWhen a model writes a file, it's usually a very iterative process, writing a few sections, reviewing, compiling, editing, then writing the next sections, etc. Our estimates so far assumed that the final `.lean` files' contents were the only output tokens produced.\n\nHow much overhead does this agentic file-editing process add? I'm not going to do careful experiments here, but I'm pretty sure it's\nless than 10× and more than 1.5× – let's say 2× to be safe? Since the output:reasoning ratios above were calculated\nusing *actual* output tokens, we need to adjust both columns:\n\n| Model | Output tokens | Reasoning tokens | API Cost | \n|---|---|---|---|\n| Sonnet 5.5 | 1 228 005 660 | 3 205 658 352 | $44 336.64 | \n| Opus 5.5 | 1 228 005 660 | 2 798 811 076 | $80 536.33 | \n| Fable 5.2 | 1 228 005 660 | 2 918 753 238 | $165 870.36 | \n\n## [Estimate 4: Wildly guessing](#estimate-4-wildly-guessing)\n\nObviously the core assumption of all the above estimates – that the model will produce a working proof of the Riemann Hypothesis on the first try – can't possibly be right. If this proof was anything like OpenAI's Navier-Stokes proof, then Alpöge used swarms of agents working in parallel on various directions. On the other hand, it sounds like Levent Alpöge directed and talked with the model more personally than the OpenAI mathematicians did. Without more details on Alpöge's harness and methods, any further estimates are nothing but wild guesses.\n\nWe've also completely ignored\n\n- input tokens (1/5th the price of output tokens),\n- token cache writes (1/4th the price of output tokens),\n- token cache reads (1/100th or 1/200th, but can be paid many times per token),\n- the difference between the API cost and the marginal cost to Anthropic of letting Alpöge use GPUs for this,\n- and the fact that he used an internal, presumably larger model.\n\nSo let's give it our best wild guess.\n\nDoes a 50× multiplier sound too high? Too low? I can't tell, and keep coming up with arguments for both sides.\n\nWhat about 100×? That would put Fable 5.2 costs near \\$17M, which would be\nsimilar to Sam Altman's [\"on the order of \\$10M\" claim](https://youtu.be/iMsUcCYNKqY?t=1078) for Navier-Stokes, although that\nwas probably referring to internal costs, not public API costs, so maybe we double that again?\n\nI guess my final estimate would be somewhere between \\$5M and \\$50M, for external costs.\n\nStrange, that's what my guess was before any of this.\n\n# [Appendix: Hand-written script](#appendix-hand-written-script)\n\nBecause I'm feeling somewhat fed up with AI, and the way it's changing my life, hobbies, career, mind and dreams, I decided to write the code to do this myself the way I loved to program: Without AI assistance, in Neovim, thinking hard.\n\nIt felt nice looking things up in the official docs, Linux man pages, StackOverflow, etc., and I specifically chose Bash so I'd have to look more up than I would in Python, for instance.\n\n``` bash\n#!/usr/bin/env bash\n\nshopt -s globstar nullglob dotglob\n\nCACHE=\"results.txt\"\nMAX=100000\nSML=50000\n\nsplit_if_large() {\n  local file=\"$1\"\n\n  # Skip if not a file or if smaller than a safish byte count\n  if [[ $(rg -F \"$file\" \"$CACHE\") ]] || [[ ! -f \"$file\" ]] ||\n     (( $(stat -c %s -- $file) < $SML )); then\n    return\n  fi\n\n  json_escaped_contents=$(jq --raw-input --slurp '.' < $file)\n\n  if (( $(echo $json_escaped_contents | wc -c) > $MAX )) then\n    split -C $SML --suffix-length=4 -d \"$file\" \"$file-split-\"\n    echo \"Successfully split $file into chunks\" && rm \"$file\"\n  fi\n}\n\nget_num_tokens() {\n  local file=\"$1\"\n\n  if [[ -f \"$file\" ]] && [[ ! $(rg -F \"$file\" $CACHE) ]] then\n    escape_all_contents=$(jq --raw-input --slurp '.' < $file)\n\n    curl https://api.anthropic.com/v1/messages/count_tokens \\\n      --silent \\\n      -H \"x-api-key: $ANTHROPIC_API_KEY\" \\\n      -H \"content-type: application/json\" \\\n      -H \"anthropic-version: 2026-10-21\" \\\n      -d '{\"model\":\"claude-opus-5-5\",\"system\":\"\",\"messages\":[\n          {\"role\":\"user\",\"content\": '\"$escape_all_contents\"'}\n          ]}' | jq \"\\\"$file: \"'''\\(.input_tokens)\"' >> $CACHE\n  fi\n}\n\ntouch \"$CACHE\"\n\n# Download and extract the LEAN proofs of the Riemann Theorem\nif [[ ! -d lean/ ]]; then\n  curl https://alpo.ge/lean.tar.gz.part{01..14} > lean.tar.gz\n  tar -xzvf lean.tar.gz && rm lean.tar.gz\nfi\n\n# Split any files that are too big for curl when json encoded\nfor file in lean/**/*; do split_if_large \"$file\" & done; wait\n\necho \"Done splitting files too big to send in a single curl.\"\n\n# Use the Anthropic API to count all file's input token count\nfor file in lean/**/*; do get_num_tokens \"$file\" & done; wait\n\nawk '{s+=$2} END {print \"Opus 5.5 output tokens: \" s}' $CACHE\n```\n\nYou may have noticed the beautiful right margin in this otherwise poor Bash code.\n\nFor years now<sup>[2](#2)</sup>, I've left the occasional block of manually justified comments in code I work on, if I was particularly pleased\nwith the accompanying code and had the time to do so.\n\nIf hand coding is now reserved for my free-time, and primarily serves my entertainment<sup>[3](#3)</sup>, there's no reason to go fast, so I took\nthe time to refactor the script until as many of the lines as possible were precisely the same length (61 characters, for no reason).\n\nPlease do not think that this is my idea of good code, and please only judge me a little for how dumb it is. I backed myself into\ncorners once I was particularly pleased with certain lines' lengths – I should have used `curl`'s ability to read whole files instead\nof passing them as Bash arguments, and I definitely shouldn't just fire off 175k parallel HTTP requests and hope they all come back.\n\nI have spent too long on this already, and won't be fixing the issues. Instead, I just ran it repeatedly until I had all the token counts.\n\nI will not be sharing how long I spent on this :) [4](#4)\n\n<sup>1</sup>\n\nAm I the only one who finds this strange? I'm sure Anthropic could give them access to Mythos if Anthropic *wanted* to. Is something about its performance, speed or cost embarrassing? Does it contradict their narrative on its cybersecurity abilities?\n\n<sup>2</sup>\n\nEver after being introduced to [this famous, manually justified masterpiece](https://gamefaqs.gamespot.com/snes/588741-super-metroid/faqs/10114).\n\n<sup>3</sup>\n\nAlthough I actually think we'll be turning to it more and more for skill maintenance.\n\n<sup>4</sup>\n\nMy wife has heard about this script, which gives an uncomfortable lower bound on how long I spent. Then again, I mostly just wanted her to see and admire the right margin.", "url": "https://wpnews.pro/news/how-much-did-proving-the-riemann-hypothesis-cost", "canonical_source": "https://mun-logadan.github.io/riemann-tokens/", "published_at": "2026-11-27 04:54:28+00:00", "updated_at": "2026-11-27 05:12:28.453830+00:00", "lang": "en", "topics": ["artificial-intelligence", "large-language-models", "ai-agents", "ai-tools"], "entities": ["Levent Alpöge", "Anthropic", "Claude", "Claude Code", "Artificial Analysis", "OpenAI", "Sonnet 5.5", "Opus 5.5"], "also_reported_by": [], "takeaway": "Producing the 614,002,830-token Lean proof as raw output costs $6,140.03 on Sonnet 5.5 versus $30,700.14 on Mythos 5, and adding max reasoning tokens plus a 2x agentic editing overhead raises the Sonnet 5.5 estimate to $44,336.64.", "recommendation": {"advice": "Budget for reasoning tokens and iterative file-editing overhead, not just final output: the source's 2x overhead and max-reasoning assumptions raised a $6,140.03 Sonnet 5.5 estimate to $44,336.64.", "playbook": "llm-cost", "playbook_url": "https://wpnews.pro/playbooks/llm-cost"}, "alternates": {"html": "https://wpnews.pro/news/how-much-did-proving-the-riemann-hypothesis-cost", "markdown": "https://wpnews.pro/news/how-much-did-proving-the-riemann-hypothesis-cost.md", "text": "https://wpnews.pro/news/how-much-did-proving-the-riemann-hypothesis-cost.txt", "jsonld": "https://wpnews.pro/news/how-much-did-proving-the-riemann-hypothesis-cost.jsonld"}}