DEV Community

near
near

Posted on

I Built an AI Research Engine and It Found a Perfect Power Law in Twin Primes

I'm a developer, not a number theorist. But I built Luka — an autonomous AI research engine — and pointed it at one of math's oldest open problems. What it found blew my mind.

How It Started

I'm a developer who builds AI frameworks. One day I had an idea: what if I could build an engine that autonomously investigates open problems in mathematics? Not just answer questions — actually research them. Run computations, test hypotheses, falsify models, write papers.

I called it Luka.

The first thing I pointed it at was the twin prime conjecture — the idea that there are infinitely many pairs of primes differing by 2, like (3,5), (11,13), (17,19). Hardy and Littlewood gave us a formula for this back in 1923:

π₂(x) ≈ 2C₂x / (log x)²
Enter fullscreen mode Exit fullscreen mode

It's elegant. It's widely used. And Luka found that it's systematically wrong.

What Luka Found

Using verified twin prime counts from 10⁶ to 10¹⁴ (33 data points across 8 orders of magnitude), Luka discovered that the residual — the gap between prediction and reality — follows a perfect power law:

R(x) ≈ 6.6 × 10⁻³ · x⁰·⁸⁶
Enter fullscreen mode Exit fullscreen mode

R² = 0.9907. But there's more. The exponent drifts, so the true model is:

R(x) ≈ C · xᵅ · (log x)^β     →    R² = 0.9997
Enter fullscreen mode Exit fullscreen mode

Bootstrap resampling (10,000 iterations) confirms α = 0.8635 ± 0.015. This isn't any known mathematical constant — it's something new.

The Critical Insight

The residual isn't about twin primes at all. The simplified formula 2C₂x/(log x)² is an approximation to the full integral 2C₂∫dt/(log t)². The difference is:

∆(x) = 2C₂(Li(x) - x/log x - x/(log x)²)
Enter fullscreen mode Exit fullscreen mode

This is the second-order term in the asymptotic expansion of Li(x). It follows a perfect power law with R² > 0.9999:

∆(x) ≈ 2.2 × 10⁻³ · x⁰·⁹⁰
Enter fullscreen mode Exit fullscreen mode

The power law characterizes the systematic error in the simplified approximation, not the true twin prime residual.

Falsifying a Model

A recent preprint proposed PRIT — an oscillatory model using Riemann zeta zeros. Luka tested it with 200 zeros computed to 25-digit precision.

The predictions were off by factors of 100–700 with wrong signs. The model is falsified by two orders of magnitude.

Extrapolation

Luka trained on just 4 data points (10⁶–10⁹) and predicted π₂(10¹⁰) with 0.99% error. Trained on 5 points, predicted π₂(10¹¹) with 1.15% error.

The Bigger Picture

I built Luka to prove that AI can do real scientific discovery — not just pattern matching on existing knowledge, but finding new structures, falsifying models, and generating testable predictions.

This paper is the first result. The power law in the twin prime residual doesn't appear in any standard reference. It was found autonomously by an AI system I built as a developer.

The times are not far when AI systems like Luka will make serious discoveries in mathematics, physics, and beyond. We're not there yet — but we're closer than most people think.

Code & Data

GitHub: github.com/subhansh-dev/twin-prime-power-law

Python, NumPy, verified computations from Nicely's database. Built with Luka.

Top comments (0)