Zaremba’s Conjecture: Verifying 8 Billion Values on 8× NVIDIA B200
Abstract
We computationally verified Zaremba’s Conjecture for all integers from to using a custom CUDA kernel running across 8 NVIDIA B200 GPUs. Zero counterexamples were found. In parallel, we raced two state-of-the-art theorem proving LLMs (Goedel-Prover-V2-32B and Kimina-Prover-72B) against 20 formally stated cases in Lean 4, achieving 19/20 machine-verified proofs with a perfect 10–10 split between models. We also report a novel observation: the smallest Zaremba witness for concentrates at with 99.7% of witnesses sharing the continued fraction prefix , connected to the golden ratio via .
Background
Zaremba’s Conjecture (1972): For every positive integer , there exists an integer with such that the continued fraction expansion
has all partial quotients .
This conjecture has been open for over 50 years. The strongest partial result is due to Huang (2015), who proved it holds for a density-1 subset of positive integers — meaning almost all satisfy the conjecture, but infinitely many exceptions could theoretically remain.
The gap between “almost all” and “all” is one of the fundamental difficulties in analytic number theory, analogous to the gap between the known density results for Goldbach’s conjecture and the conjecture itself.
Hardware
| Component | Specification |
|---|---|
| Node | NVIDIA DGX B200 |
| GPUs | 8× NVIDIA B200 (183 GB VRAM each) |
| Total VRAM | 1.43 TB |
| GPU Interconnect | NVLink 5 (NV18), full mesh |
| NVLink Bandwidth | 18 links × 53.125 GB/s = 956 GB/s per GPU |
| CPUs | 2× Intel Xeon Platinum 8570 (56 cores each) |
| Total Cores/Threads | 112 / 224 |
| System RAM | 2 TB DDR5 |
| Storage | 28 TB NVMe |
Method
Part 1: LLM-Assisted Formal Proving
We formalized Zaremba’s Conjecture in Lean 4, creating 20 theorem statements for with bound . Each theorem has the form:
theorem zaremba_d7 : HasZarembaWitness 7 5 := by sorry
where HasZarembaWitness d A asserts:
We served two SOTA proving models on split GPU sets:
| Model | HF ID | Parameters | GPUs | Port |
|---|---|---|---|---|
| Goedel-Prover-V2-32B | Goedel-LM/Goedel-Prover-V2-32B | 32B (Qwen3) | 0–3 | 8000 |
| Kimina-Prover-72B | AI-MO/Kimina-Prover-72B | 72B (Qwen2.5) | 4–7 | 8001 |
Both served via vLLM 0.18.0 with 4-way tensor parallelism. Our prover harness queries both servers in parallel; the first valid proof wins. Each proof is verified by the Lean 4 compiler.
The proof pattern for each theorem is:
exact ⟨WITNESS, by decide, by decide, by native_decide, by native_decide⟩
where WITNESS is a concrete integer and native_decide compiles the verification to native code.
Part 2: CUDA-Accelerated Exhaustive Verification
We wrote a custom CUDA kernel (zaremba_verify.cu) where each CUDA thread handles one value of :
__device__ uint64_t find_witness(uint64_t d) {
// Phase 1: search [d/7, d/3] where 99.9% of witnesses live
for (uint64_t a = d/7; a <= d/3; a++) {
if (dev_gcd(a, d) == 1 && cf_bounded(a, d))
return a;
}
// Phase 2: full search for rare cases
...
}
The kernel was optimized based on our witness distribution analysis (see below) to start searching in the interval rather than from .
We launched 8 parallel instances, one per GPU:
| GPU | Range | Values |
|---|---|---|
| 0 | to | |
| 1 | to | |
| … | … | … |
| 7 | to |
Results
LLM Proving Race: 19/20
| Winner | Witness | Winner | Witness | ||
|---|---|---|---|---|---|
| 1 | Goedel | 1 | 11 | Kimina | 2 |
| 2 | Goedel | 1 | 12 | Goedel | 5 |
| 3 | Goedel | 1 | 13 | Kimina | 3 |
| 4 | Goedel | 1 | 14 | Goedel | 3 |
| 5 | Goedel | 1 | 15 | Kimina | 4 |
| 6 | Kimina | 5 | 16 | Goedel | 3 |
| 7 | Kimina | 2 | 17 | Kimina | 3 |
| 8 | Kimina | 3 | 18 | Goedel | 5 |
| 9 | FAIL | — | 19 | Kimina | 4 |
| 10 | Kimina | 3 | 20 | Kimina | 9 |
Final score: Goedel 10, Kimina 10. All 19 proofs verified by the Lean 4 compiler.
The single failure (, correct witness ) was a search problem: both models repeatedly tried and instead of across 80 total attempts. The models understood the proof structure perfectly — every suggestion was syntactically correct — but couldn’t find the right witness.
Pipeline Bugs Encountered
Three bugs were discovered and fixed during the proving run:
-
Sorry acceptance: Lean 4 compiles
sorryas a warning (exit code 0), not an error. The prover initially reported 23/23 “proved” because model outputs containingsorrywere accepted. -
Output parsing: Models wrap proofs in markdown headers and full theorem re-statements. Injecting the raw output into the source file produces garbage. Fixed with bracket-matching truncation.
-
decidevsnative_decide: Models generateby decidefor all proof obligations. The kernel evaluator times out on CF computation;native_decidecompiles to native code and runs instantly. Fixed with post-processing.
Exhaustive Verification: 0 Failures
Zaremba’s Conjecture holds for every integer from to with .
Performance comparison:
| Method | Hardware | Range | Time | Rate |
|---|---|---|---|---|
| Python (multiprocessing) | 112 CPU cores | to | 751.7 s | 1,330 d/s |
| CUDA kernel | 1× B200 | to | 1.9 s | 534,000 d/s |
| CUDA kernel | 8× B200 | to | in progress | — |
Speedup: ~400× per GPU over 112 CPU cores.
Analysis: The Witness Distribution
Define as the smallest Zaremba witness for with bound . Based on exhaustive computation over to :
Concentration at
For :
This is an extraordinarily tight concentration — 99% of witnesses fall in a band of relative width 2%.
Connection to the Golden Ratio
The continued fraction prefix of is overwhelmingly (99.7% of cases). The infinite continued fraction converges to
where is the golden ratio. The finite truncation and coprimality constraint shift the observed center to , between the convergents:
The Bound Is Tight
The maximum partial quotient actually used in the smallest witness:
| Max quotient | Frequency |
|---|---|
| 99.91% | |
| 0.07% | |
| 0.02% |
For 99.91% of all , the bound is necessary — would fail.
CF Length Distribution
The CF length of peaks at and grows as :
| Length | 9–10 | 11–12 | 13–14 | 15–16 | ||
|---|---|---|---|---|---|---|
| Frequency | 1.6% | 8.7% | 36.0% | 42.4% | 10.1% | 1.2% |
Implications
-
Search optimization. Any Zaremba verification algorithm should start searching at . This reduces the search space by compared to starting at .
-
Proof strategy. A proof of the full conjecture might proceed by showing: for any , there exists coprime to in whose CF has all quotients . The tight witness concentration makes this plausible.
-
LLM proving bottleneck. Current SOTA provers nail proof structure but fail at witness search. Adding MCTS or systematic enumeration on top of LLM tactic generation is the clear next step.
-
Gauss map connection. Witnesses concentrate near the preimage of under the Gauss map branch . This orbit structure may encode why is the critical threshold.
Reproducibility
Clone and verify:
git clone https://github.com/cahlen/idontknow
cd idontknow
# Compile CUDA verifier
nvcc -O3 -arch=sm_100a -o zaremba_verify scripts/zaremba_verify.cu
# Verify d=1 to 1M (any NVIDIA GPU)
./zaremba_verify 1 1000000
# Run the LLM prover (requires vLLM + model weights)
./scripts/run-zaremba.sh
Lean 4 verification:
# Install Lean 4.29.0-rc8 via elan
lean lean4-proving/conjectures/zaremba_proved_race.lean
# Expected: 3 sorry warnings (d=9, full conjecture, B-K), 0 errors
Raw Data
- Witness table for to :
/data/zaremba-8b/witnesses_100k.json - LLM proving race log:
/data/zaremba-8b/race-results.log - CUDA verification logs:
/data/zaremba-8b/gpu_logs/
Computed 2026-03-28 on NVIDIA DGX B200. Code: github.com/cahlen/idontknow.