Can a Neural Network Help Us Get Closer to the Riemann Hypothesis?

I tested whether networks can rediscover the known laws of the zeta zeros, then used them to look for more

· 15 min read · ai-ml

I have been curious about the Riemann Hypothesis for a long time. It is the most famous open problem in mathematics, and it is easy to state: the “zeros” of one particular function, the Riemann zeta function, all seem to sit on a single straight line. Nobody has proved it. And those zeros are tied to something very concrete, the way prime numbers are spread out.

At the same time I kept seeing a different kind of result in AI: neural networks that look at data from physics and give back an actual equation, not only a prediction. So the question came naturally. Could that work on the zeros? And if it does, could it help us find something new?

This post is how I tried to answer that, in two steps. I should say up front that I did not prove anything, and I did not find a new theorem. But I learned what this approach can and cannot do, and one pattern surprised me, and checking it taught me something.

The tool

I did not invent this method. It comes from existing work that started by asking the same question: can neural networks help us derive mathematical and physical equations? The foundational paper is Cranmer et al. (2020), Discovering Symbolic Models from Deep Learning with Inductive Biases. They trained networks on physical systems, then turned what the networks learned into equations. The equations recovered known force laws, and they also found a new formula for dark matter concentration. More recent work builds on it: SymTorch (2026) packages the idea as a library, and Kolmogorov-Arnold Networks (KAN 2.0) are designed so that what the network learns can be read as a formula. I took this recipe and tried it on the Riemann zeros, using PySR and KAN to read the formulas.

The method has three simple steps:

  1. Train a small neural network on raw data about the zeta function. No formula is given.
  2. Read an equation out of the trained network, using a technique called symbolic regression.
  3. Check whether that equation, and its numbers, match something known.

The trick is in how you build the network. You give it a structure that is able to express the right answer, for example “add up a contribution from every prime” or “let neighbouring zeros push on each other”. Without that structure it gets lost. My first attempt at one of the tasks used a fully free network and got stuck at a wrong answer. A simpler, more structured one worked. In fact, for several tasks the “network” that worked was a single, well-designed layer. The structure did most of the work, not the depth.

I used Odlyzko’s tables of the first two million zeros, plus samples of zeros at much higher places, up to the 10²¹-th.

I did not do this alone. I was assisted by Claude Code, running the Claude Opus 5.5 model, which ran most of the code and the experiments and did the literature search. That includes the search that showed one of my results was already known, as you will see below.

Step 1: does it work at all?

Before looking for anything new, I needed to know the tool is honest. If I cannot get known mathematics back out of it, I have no reason to trust it on unknown questions. So I asked the networks about things mathematicians already know.

They got most of them back:

  • How many zeros are there? The network found the counting formula. The famous constant 7/8 came from a careful look at what the formula left over.
  • How do the zeros know about primes? I gave the network a wave for every whole number from 2 to 150, without saying which are prime. It chose exactly the 48 prime powers and ignored everything else, with no false positives. The weights it learned match the classical formula, with the constant 1/π. It found the primes by itself.
  • How do the primes know about the zeros? I asked the network to rebuild the prime counts from the zeros, and to tell me where it thinks the zeros sit. It answered 0.4998, against the expected 0.5, and it recovered the shape of the classical formula.
  • How do zeros behave next to each other? They repel like charged particles, with a force that falls off like 2/distance. The network found exactly that law. With it I could predict when two zeros would collide in a deformed version of the problem, within 0.4% of the exact computation.
  • How spread out are the gaps? The network found the repulsion of random-matrix theory. For zeros near the 10²¹-th, the exponent is 1.98 ± 0.02, against the expected 2. Lower down it is higher (about 2.3) and moves toward 2 as the zeros get higher.

I could also chain these laws. Using only the primes up to 10,000, the formulas locate each of the first 2,000 zeros with a typical (median) error of 3% of the average gap between zeros.

Here is how those laws connect. Each arrow is an equation a network recovered:

PRIMES2 · 3 · 5 · 7 …THE ZEROSON THE LINE, AT ½COUNTING LAWHOW MANY ZEROSGAP PATTERNRANDOM MATRICES, β = 2ZEROS REPELFORCE 2 / DISTANCEA TEST FOR RHLI NUMBERS λₙRHWAVES AT PRIME POWERSEXPLICIT FORMULAA LOOP,TESTED END TO END+ 7/8POSITIVE ⇔ RH

every arrow is an equation a network recovered · dashed box: the open problem

So the answer to step 1 is yes. The tool rediscovers mathematics that took people decades.

Step 2: if discovery is cheap, how far can it go?

That result changed my question. If I have a cheap way to read laws out of data, I am no longer limited to checking old results. I can ask new questions, and use the tool to find clues, test assumptions, or challenge what we think we know.

The question I picked: which of these laws need the deep arithmetic of zeta, and which ones follow only from its symmetry?

To find out, I needed a function that looks like zeta but breaks the rule. There is a classical one, the Davenport–Heilbronn function. It has the same symmetry as zeta, but it lacks one key property, the Euler product, which is what ties zeta to the primes. And it has zeros off the line. In my computation, below height 25,000, there are 32,113 zeros on the line and 1,646 off it.

I also added a well-behaved cousin, called L(s, χ₋₄), as a control, and ran everything again on all three functions.

What I asked the networkζwell-behaved cousinfake (no Euler product)
Which whole numbers matter?48 of 48 prime powers, nothing else41 of 41 odd prime powers, nothing else79 numbers, including 38 composites
Where do the zeros sit?0.50000.50020.775
Do the gaps follow the random-matrix law?yesyesno
Do the counting law and the “zeros push each other” law hold?yesyesyes

This was the first real finding. Some laws only need the symmetry of the function, and they survive in the fake. Others need the Euler product, and they break. Nobody had to tell the network this. Its choices revealed the missing Euler product: for the fake function it also chose composite numbers, and the weights it chose matched the true structure with a correlation of 0.993.

It also measured how far off the line each zero sits. The line is at real part 0.5. Once I gave it the heights of the zeros, it recovered their real parts almost exactly:

Height of the zeroTrue real partReal part the network learned
85.700.80850.8092
176.700.72430.7215
240.400.86950.8699

One honest limit here: it needs to be told where the zero is. It does not find off-line zeros on its own.

A check that humbled me

There is a well-known test for the Riemann Hypothesis, called Li’s criterion. It gives an infinite list of numbers, and the hypothesis is true exactly when every number on the list is positive.

I ran it on the fake function, which I know has off-line zeros, even one at height 86. Every number came out positive, all the way to the 2,000th. A quick check would have told me this function was fine. It is not. The first negative number is predicted to appear only around the 330,000th.

The reason is simple. An off-line zero’s effect on these numbers grows extremely slowly: roughly like its distance from the line divided by its height squared. So it can take hundreds of thousands of terms before even a low, clearly off-line zero shows up. Every numerical check of the Riemann Hypothesis has a limit of this kind. Even the direct checks, which have verified the first 10¹³ zeros (Gourdon), only reach a finite height. Data can support the hypothesis. It cannot prove it.

One thing I did not expect

While looking at the fake function, I noticed something odd in its statistics: a sharp regular pattern that should not be there. When I looked closer, its zeros were arranged on a kind of lattice of “slots”, as if each zero had a parking space. (Experts will recognise these as Gram points.) The off-line zeros sit where parking spaces are empty.

I wanted to know whether this is special to the fake function, so I measured how strongly zeros stick to their slots across 34 different functions, and for zeta up to height 10²⁰.

Two things came out:

  1. The sticking follows a simple law, and it turned out to be known. Using a random-phase model, I derived a formula with no fitted constant, R(P) = 1 − P(1 − e^(−1/P)). Here P measures how far the rest of the function pushes zeros away from their slots. It matched 29 data points from functions with an Euler product (Dirichlet L-functions, and zeta at several heights) to about 5%. I was excited, so I went looking for prior work. For zeta, this is already a theorem (Arias de Reyna 2015, building on Schoißengeier): the sticking fades like 1/log T. I carried the same argument over to the other functions with an Euler product. That extension is my own, not from the paper. It fits my data slightly better than my formula does (4.0% error, against 5.2%). So the network pointed at real structure, but structure that mathematicians had already proved.
  2. What the Euler product controls is not the sticking, it is the empty slots. With an Euler product, no slot is left empty at any strength of sticking: all the zeros stay on the line, to the accuracy of my search. Without it, only between 73% and 96% do.

Put another way: “all the zeros are on the line” looks like it is about every slot being occupied. That is a slightly different way to look at the Riemann Hypothesis, and I find it a useful one.

So, does a neural network help discover new laws?

My honest answer, after this first round: not yet, but it helps in a real way.

  • It did not give me a new theorem, and I do not think it is close to one.
  • It gave me a tested, cheap tool that gets known laws back from data, with the right constants.
  • Used on a control, it told me precisely which laws depend on which property. That is a map of where a proof would have to work: a proof has to use the Euler product, and not only the symmetry of the function.
  • It led me to a measurable pattern, the slots, and to a simple law for it. The law turned out to be a known theorem (Arias de Reyna 2015), and the mechanism behind the fake function’s first off-line zero is known in qualitative form (Jerby 2023). What I could not find in the literature is a statistical description of the fake functions themselves: how many slots go empty, and why their zeros stick more strongly than the law predicts. If you know of work on this, I would be glad to hear from you.

I think that is the right way to see it. The network is not the mathematician. It is a fast, honest instrument that points at where to look.

What this does not show

  • Nothing here is a new law about zeta. Every result for zeta itself is classical or a known conjecture. What is new is that a network finds them without being told the form.
  • It is far from a proof. The data reaches height 50,000 for the well-behaved cousin and 25,000 for the fake function. The slot study covers about 2,000 zeros per function.
  • Some things did not work. One family of weights was too small to recover. The push-each-other force for the well-behaved cousin came out 7% too weak. And a measured spread was 10% above the theoretical value.
  • My slot law is a heuristic, and the real law was already known. My formula assumes the other terms of the function behave like random phases. For functions with an Euler product, the known theorem does slightly better. For the fake functions, neither describes the data exactly. For the three with the most off-line zeros, the measured sticking is 13% to 29% above what my model predicts, and I have no explanation.
  • The zero counts are not perfect. For 7 of the 12 fake functions the count closes to within three zeros. A few zeros are still missing in the others.

What comes next

The lesson of the slot law is that the bottleneck is not finding patterns. It is knowing whether a pattern is already known. So my next step is to talk to number theorists before running more experiments. In particular, I want to ask whether the statistics of the fake functions, the empty slots, are already understood and whether they are interesting.

If they are open, the tool is ready to go deeper there. I would also like to try to challenge things. If the network disagrees with a conjecture at some scale, that is the most interesting outcome of all.

I do not expect a neural network to prove the Riemann Hypothesis. But a cheap way to ask “what is the law here?” about a very hard object, and to get an honest answer back, is a useful thing to have.