Skip to main content

The Riemann Hypothesis

What is the Riemann hypothesis?​

The Riemann hypothesis is the conjecture, made by Bernhard Riemann in 1859, that the Riemann zeta function's non-trivial zeros all have real part exactly 1/2. On the complex plane, every zero inside the critical strip would then lie on one vertical line, the critical line. It is unproven; if true, it pins down how evenly the prime numbers are spread.

Four charts on a dark navy background. Top left, Hardy's Z function oscillating along the critical line from t = 0 to 100, with 29 orange dots where it crosses zero. Top right, the path of the zeta function in the complex plane for t from 0 to 40, a looping curve that passes through the origin at six orange dots. Bottom left, the step function counting primes up to 100, a dashed logarithmic integral curve and a blue curve rebuilt from 30 zeros that follows the steps. Bottom right, a histogram of normalised gaps between the first 5,000 zeros, matching an orange random-matrix curve rather than a dashed random-points curve

Four views of the zeta function, all computed in the browser: Z(t) and its zeros, the zeta spiral through the origin, the primes rebuilt from zeros, and the gaps between zeros. Try the interactive version.

Key takeaways
  • The zeta function is zero at -2, -4, -6, … (the trivial zeros) and at infinitely many points in the strip 0 < Re s < 1. The hypothesis says those all have real part 1/2.
  • On the critical line the zeros show up as sign changes of a real function, Hardy's Z(t). The first is at height 14.134725….
  • Each zero adds one wave to Riemann's formula for the number of primes. Zeros on the line keep the errors in prime counts as small as they can be.
  • More than 12 trillion zeros have been checked and all lie on the line. That is strong evidence, not a proof.
  • The gaps between zeros follow the statistics of eigenvalues of large random matrices, not of random points.

The hypothesis is one of the seven Millennium Prize Problems of the Clay Mathematics Institute, with a prize of one million US dollars for a proof. It was also on David Hilbert's list of 23 problems in 1900. As of November 2026 the Clay Institute lists it as unsolved.

The Riemann zeta function​

For a number ss with real part greater than 1, the zeta function is the sum

ζ(s)=∑n=1∞1ns=1+12s+13s+14s+⋯\zeta(s) = \sum_{n=1}^{\infty} \frac{1}{n^s} = 1 + \frac{1}{2^s} + \frac{1}{3^s} + \frac{1}{4^s} + \cdots

At s=2s = 2 the sum is π2/6≈1.6449\pi^2/6 \approx 1.6449. As ss falls towards 1 the sum grows without limit, and at s=1s = 1 it becomes the harmonic series, which diverges. Riemann used complex values s=σ+its = \sigma + it, where σ\sigma is the real part and tt the imaginary part, or height.

Euler had already found the link with primes in 1737. Because every whole number is a product of primes in exactly one way, the sum can be rewritten as a product with one factor for each prime pp:

ζ(s)=∏p prime11−p−s=11−2−s⋅11−3−s⋅11−5−s⋯\zeta(s) = \prod_{p\ \text{prime}} \frac{1}{1 - p^{-s}} = \frac{1}{1-2^{-s}} \cdot \frac{1}{1-3^{-s}} \cdot \frac{1}{1-5^{-s}} \cdots

This Euler product is why a statement about the zeros of zeta turns into a statement about primes.

Analytic continuation and the functional equation​

The sum only converges when the real part of ss is above 1, but the function itself extends to every complex number except s=1s = 1, where it has a pole. This extension, the analytic continuation, is unique: there is only one smooth (complex-differentiable) function that agrees with the sum where the sum converges. Values such as ζ(−1)=−1/12\zeta(-1) = -1/12 come from the continued function, not from adding up 1+2+3+⋯1 + 2 + 3 + \cdots.

Riemann showed that the continued function satisfies a functional equation linking ss and 1−s1 - s:

ζ(s)=2sπs−1sin⁡(πs2)Γ(1−s) ζ(1−s)\zeta(s) = 2^s \pi^{s-1} \sin\left(\frac{\pi s}{2}\right) \Gamma(1-s)\, \zeta(1-s)

where Γ\Gamma is the gamma function. It reflects the plane in the line σ=1/2\sigma = 1/2, which is why that line is special. A computer evaluates zeta inside the strip with a formula that converges there, such as Euler–Maclaurin summation.

Trivial and non-trivial zeros: the critical strip and the critical line​

The zeta function has two kinds of zeros: trivial zeros at the negative even integers, and non-trivial zeros inside the critical strip, which the hypothesis places on the critical line.

The complex plane of the zeta function. The horizontal axis is the real part sigma from -7 to 3 and the vertical axis the imaginary part t from -30 to 30. Blue dots on the real axis at -2, -4 and -6 are the trivial zeros. A cross at 1 is the pole. A shaded vertical band between 0 and 1 is the critical strip, and a red dashed line down its middle at one half is the critical line. Red dots on that line at heights 14.13, 21.02 and 25.01, with mirror images below the axis, are the first non-trivial zeros. A green region to the right of 1 is where the series converges

The zeros of the zeta function come in two kinds.

  • The trivial zeros are at s=−2,−4,−6,…s = -2, -4, -6, \ldots. The sine factor in the functional equation forces them, and they tell us nothing about primes.
  • The non-trivial zeros all lie in the critical strip, 0<σ<10 < \sigma < 1. There are infinitely many of them. They are written ρ=β+iγ\rho = \beta + i\gamma, and they come in mirror-image pairs: if β+iγ\beta + i\gamma is a zero, so is β−iγ\beta - i\gamma. The functional equation adds a second symmetry, about the line σ=1/2\sigma = 1/2.

The critical line is σ=1/2\sigma = 1/2, the centre of the strip. The Riemann hypothesis states that β=1/2\beta = 1/2 for every non-trivial zero. Because of the two symmetries, a zero off the line would always come with three partners, at 1−β±iγ1 - \beta \pm i\gamma and β−iγ\beta - i\gamma.

The first ten zeros above the real axis, at 1/2+iγ1/2 + i\gamma:

ZeroHeight γ\gammaZeroHeight γ\gamma
114.134725637.586178
221.022040740.918719
325.010858843.327073
430.424876948.005151
532.9350621049.773832

These match Andrew Odlyzko's published table and the LMFDB. Computed from scratch with the methods on this page, the first 5,163 zeros agree with Odlyzko's table to better than one part in a million.

How to see the zeros: Hardy's Z function​

Zeta is complex-valued, so on the critical line it can't simply be drawn as one curve against tt. G. H. Hardy's trick is to rotate each value by a known angle so that the result is real:

Z(t)=eiθ(t) ζ ⁣(12+it),θ(t)=arg⁡Γ ⁣(14+it2)−t2ln⁡πZ(t) = e^{i\theta(t)}\, \zeta\!\left(\tfrac{1}{2} + it\right), \qquad \theta(t) = \arg \Gamma\!\left(\tfrac{1}{4} + \tfrac{it}{2}\right) - \frac{t}{2}\ln \pi

The rotation doesn't change the size, so ∣Z(t)∣=∣ζ(1/2+it)∣|Z(t)| = |\zeta(1/2 + it)|, and Z(t)Z(t) is a real number for every real tt. When the curve of Z(t)Z(t) crosses the axis, zeta is zero on the line. For example Z(14)≈−0.106Z(14) \approx -0.106 and Z(14.2)≈0.052Z(14.2) \approx 0.052, so a zero lies between them: the first one, at 14.134725.

A sign change proves a zero is on the line, which is how the numerical checks work. The opposite is not automatic: a zero off the line would show up as a place where Z(t)Z(t) dips towards the axis and turns back without crossing, combined with a count of zeros (next section) that comes out one pair short.

The Riemann–Siegel formula​

For large tt, Z(t)Z(t) is computed with the Riemann–Siegel formula. With N=⌊t/2π⌋N = \lfloor \sqrt{t/2\pi} \rfloor,

Z(t)=2∑n=1Ncos⁡(θ(t)−tln⁡n)n+R(t)Z(t) = 2 \sum_{n=1}^{N} \frac{\cos\left(\theta(t) - t \ln n\right)}{\sqrt{n}} + R(t)

where R(t)R(t) is a remainder of size about t−1/4t^{-1/4} that is itself given by a series of correction terms C0,C1,C2,…C_0, C_1, C_2, \ldots. Only about t/2π\sqrt{t/2\pi} terms are needed: 3 at t=100t = 100 and 28 at t=5,000t = 5{,}000. Carl Ludwig Siegel found the formula in Riemann's unpublished notes and published it in 1932, so Riemann had computed the first few zeros himself.

The formula is an asymptotic series, accurate for large tt and poor for small tt. With five correction terms it agrees with direct evaluation to within about 3×10−73 \times 10^{-7} from t=50t = 50 upwards. Below that, evaluating zeta directly is cheap and more accurate.

How many zeros are there? The Riemann–von Mangoldt formula​

Let N(T)N(T) be the number of non-trivial zeros with height between 0 and TT. Riemann stated, and Hans von Mangoldt proved in 1905, that

N(T)=T2πln⁡T2π−T2π+78+S(T)+O ⁣(1T)N(T) = \frac{T}{2\pi}\ln\frac{T}{2\pi} - \frac{T}{2\pi} + \frac{7}{8} + S(T) + O\!\left(\frac{1}{T}\right)

where S(T)S(T) is a small, irregular term that grows extremely slowly with TT. The zeros get closer together as tt rises: the average gap near height tt is 2π/ln⁡(t/2π)2\pi / \ln(t/2\pi), about 2.3 at t=100t = 100 and 0.94 at t=5,000t = 5{,}000.

Height TTSign changes of Z(t)Z(t) up to TTFormula without S(T)S(T)
1002929.0
1,000649648.6
5,0004,5204,520.3

This count is what makes numerical checks rigorous. Alan Turing's method combines the formula with a proven bound on the average of S(T)S(T) to certify the exact number of zeros in the strip up to height TT. If the sign changes of Z(t)Z(t) up to TT account for all of them, every zero up to TT is on the line.

Why the Riemann hypothesis matters: the primes​

The prime-counting function π(x)\pi(x) is the number of primes up to xx: π(10)=4\pi(10) = 4, π(100)=25\pi(100) = 25. Drawn as a chart, it is a staircase that steps up by one at each prime.

Gauss guessed that primes near xx have density about 1/ln⁡x1/\ln x, which gives the logarithmic integral

li⁡(x)=∫0xdtln⁡t\operatorname{li}(x) = \int_0^x \frac{dt}{\ln t}

(taken as a principal value, because the integrand blows up at t=1t = 1; the offset version Li⁡(x)=li⁡(x)−li⁡(2)\operatorname{Li}(x) = \operatorname{li}(x) - \operatorname{li}(2) starts the integral at 2 and differs by about 1.045). The prime number theorem, proved by Hadamard and de la Vallée Poussin in 1896, says π(x)/li⁡(x)→1\pi(x) / \operatorname{li}(x) \to 1. Its proof rests on zeta having no zeros on the line σ=1\sigma = 1.

xxπ(x)\pi(x)x/ln⁡xx / \ln xli⁡(x)\operatorname{li}(x)li⁡(x)−π(x)\operatorname{li}(x) - \pi(x)Bound if the hypothesis holds
1,000168144.8177.69.68.7 (applies from 2,657)
100,0009,5928,685.99,629.837.8144.9
1,000,00078,49872,382.478,627.5129.5549.7
10,000,000664,579620,420.7664,918.4339.42,028.0

The last column is the bound Lowell Schoenfeld proved in 1976 on the assumption that the hypothesis holds. The converse follows from an argument going back to Helge von Koch in 1901, so the hypothesis is equivalent to the bound: it is true if and only if

∣π(x)−li⁡(x)∣<x ln⁡x8πfor all x≥2657|\pi(x) - \operatorname{li}(x)| < \frac{\sqrt{x}\,\ln x}{8\pi} \quad \text{for all } x \ge 2657

So the hypothesis is a precise claim about how small the error in the prime number theorem stays, roughly the square root of xx. A zero off the line at real part β>1/2\beta > 1/2 would make the error grow like xβx^\beta instead.

Riemann's explicit formula: primes from zeros​

Riemann went further and wrote the prime count exactly in terms of the zeros. In one standard form, with J(x)=π(x)+12π(x1/2)+13π(x1/3)+⋯J(x) = \pi(x) + \tfrac12\pi(x^{1/2}) + \tfrac13\pi(x^{1/3}) + \cdots,

J(x)=li⁡(x)−∑ρli⁡(xρ)−ln⁡2+∫x∞dtt (t2−1)ln⁡tJ(x) = \operatorname{li}(x) - \sum_{\rho} \operatorname{li}(x^{\rho}) - \ln 2 + \int_x^{\infty} \frac{dt}{t\,(t^2-1)\ln t}

and π(x)\pi(x) is recovered as ∑nμ(n)nJ(x1/n)\sum_n \frac{\mu(n)}{n} J(x^{1/n}), where μ\mu is the Möbius function. The sum runs over all the non-trivial zeros, taken in pairs in order of height. Each pair contributes a wave of the form

2x∣ρ∣ln⁡xcos⁡(γln⁡x−arg⁡ρ)\frac{2\sqrt{x}}{|\rho| \ln x} \cos\left(\gamma \ln x - \arg\rho\right)

to leading order: an oscillation in ln⁡x\ln x with frequency γ\gamma and an amplitude that grows like xβx^\beta, which is x\sqrt{x} on the critical line. Adding waves of increasing frequency to sharpen a smooth curve into steps is the same idea as a Fourier series building a square wave (see the Fourier transform guide).

With no zeros, the formula is a smooth curve close to li⁡(x)\operatorname{li}(x). With 30 zeros it gives 15.07 at x=50x = 50 and 25.18 at x=100x = 100, against true counts of 15 and 25; with 300 zeros, 15.02 and 25.01, and the steps at each prime are sharp.

The evidence for the Riemann hypothesis​

The evidence for the hypothesis is strong but not a proof: trillions of zeros checked by computer, and theorems that put a large share of all zeros on the critical line.

Numerical verification​

Each generation of computers has checked more zeros. In 2021 Dave Platt and Tim Trudgian proved, with rigorous interval arithmetic, that every zero up to height 3×10123 \times 10^{12} lies on the critical line: the first 12,363,153,437,138 zeros. Odlyzko's computations have checked large blocks of zeros much higher up, near the 102010^{20}-th zero and beyond.

Theorems​

  • Hardy proved in 1914 that infinitely many zeros lie on the critical line.
  • Selberg proved in 1942 that a positive proportion of them do. Conrey raised the proportion above two-fifths in 1989, and Pratt, Robles, Zaharescu and Zeindler above five-twelfths in 2020. Two preprints from 2026, not yet refereed, claim that more than two-thirds of the zeros are simple and on the line.
  • No zero has real part 1 (the prime number theorem), and there are explicit zero-free regions just inside the strip.
  • In autumn 2026, preprints claimed the first zero-free half-plane of fixed width inside the critical strip (a "quasi-Riemann hypothesis"). None had been refereed by November 2026, and none says anything about the line 1/2 itself.

None of these shows that all of the zeros are on the line.

Montgomery–Odlyzko: zeros behave like random-matrix eigenvalues​

In 1973 Hugh Montgomery studied the gaps between zeros and found a formula for how often two zeros are a given distance apart. Freeman Dyson recognised it: the same formula describes eigenvalues of big random Hermitian matrices drawn from the Gaussian Unitary Ensemble (GUE). Odlyzko's computations, from 1987 on, confirmed the match with huge samples of zeros far up the line.

To compare gaps at different heights, divide each gap between neighbouring zeros by the average gap at its height, so the average is 1. A histogram of these normalised gaps can then be set against the Wigner surmise p(s)=32π2s2e−4s2/πp(s) = \frac{32}{\pi^2} s^2 e^{-4s^2/\pi}, a close approximation to the GUE distribution. Random points (a Poisson process) would have gaps following e−se^{-s}, with 18.1% of gaps under 0.2. The first 5,000 zeros have 0.5% under 0.2: they repel each other, as eigenvalues do. These low zeros fit the GUE curve only roughly, with even fewer very small gaps than it predicts. The close agreement Odlyzko found is for zeros at great heights.

The status in November 2026​

Claimed proofs appear from time to time, some now written in proof assistants such as Lean so that a computer can check each step. Partial results are moving faster: in 2026, preprints claimed that more than two-thirds of the zeros are on the line, and the first zero-free half-plane of fixed width inside the strip. None had been refereed by November 2026, and none implies the hypothesis. A claim counts only once mathematicians have checked it, including that the formal statement really is the Riemann hypothesis, and the result has been accepted. Until then the hypothesis is unproven, and the Clay Mathematics Institute lists it as unsolved.

Ways to visualise the Riemann hypothesis​

Each way of charting the zeta function shows a different side of the hypothesis, from counting zeros to watching them rebuild the primes.

ChartWhat it showsBest for
Z(t) line chartReal oscillating curve; zeros are where it crosses the axisLocating and counting zeros on the critical line
Zeta spiral (real part against imaginary part)The path of ζ(σ+it)\zeta(\sigma + it) as tt rises; on the line it passes through the origin at each zeroSeeing why the line is special, by moving σ\sigma off 1/2
Prime staircase with the explicit formulaπ(x)\pi(x), li⁡(x)\operatorname{li}(x) and the curve rebuilt from N zerosShowing what the zeros have to do with primes
Spacing histogramNormalised gaps between zeros against the GUE and Poisson curvesThe statistics of the zeros
Domain colouring or $\zeta$ heatmap
N(T) step chartThe count of zeros against the Riemann–von Mangoldt curveChecking that no zeros are missing

The first four are in the live demo below. A ∣ζ∣|\zeta| heatmap over a rectangle of the plane is a natural extension, drawn with a heatmap series.

Common misconceptions about the Riemann hypothesis​

Most misconceptions about the hypothesis overstate what is known or confuse the zeros with the primes.

  • "It has been proven." Not as of November 2026. Claimed proofs appear from time to time; none has been accepted, and the Clay Mathematics Institute lists the problem as unsolved.
  • "Trillions of verified zeros prove it." A numerical check covers finitely many zeros out of infinitely many. Other conjectures in number theory held for every case anyone could compute and still turned out false, and the first counterexample to the claim that π(x)<li⁡(x)\pi(x) < \operatorname{li}(x) is known to be far beyond direct computation.
  • "The zeros are the primes." They are not. The zeros are complex numbers such as 1/2+14.1347i1/2 + 14.1347i; the primes are whole numbers. The link is Riemann's explicit formula, where each zero adds one wave to the count of primes.
  • "The trivial zeros are counterexamples." The zeros at −2,−4,−6,…-2, -4, -6, \ldots are outside the critical strip, and the hypothesis says nothing about them.
  • "1+2+3+⋯=−1/121 + 2 + 3 + \cdots = -1/12." The series diverges. ζ(−1)=−1/12\zeta(-1) = -1/12 is the value of the analytically continued function, not a sum.
  • "A zero is missing where Z(t)Z(t) only touches the axis." On a chart, a close pair of zeros can look like a touch. Zoomed in, the curve crosses twice, and the count of sign changes matches the Riemann–von Mangoldt formula.

How to visualise the Riemann hypothesis in JavaScript, React or Angular​

Everything here is computed in the browser, from the zeta function up: more than 5,000 zeros at start-up, then 100,000 points of Z(t)Z(t) when you pick the longest range. When you move a control, SciChart.js redraws the chart's line, scatter or rectangle series with WebGL and WebGPU; pick the longest range to see how it handles 100,000 points on your device.

Pick a range from t from 0 to to draw Z(t)Z(t) up to 5,000, with every zero marked and counted against the Riemann–von Mangoldt formula. Drag σ away from 0.5 and the zeta spiral stops passing through the origin; t up to lengthens the path. Zeros adds zeros one by one to Riemann's explicit formula, so the steps of the prime staircase sharpen. First sets how many zeros go into the gap histogram. Scroll to zoom, drag to pan and double-click to reset.

Here is the code for the four charts. The zeta function, Hardy's ZZ, the zero search and the explicit formula are plain JavaScript in the same file, above this part; SciChart.js draws the results. The React and Angular versions show the core chart, Z(t)Z(t) with its zeros marked.

// Four linked views of the Riemann zeta function, all computed in the browser: Hardy's Z(t) along the critical
// line, the path of zeta(sigma + it) in the complex plane, the primes rebuilt from the zeros, and the gaps
// between zeros against random-matrix theory
const {
SciChartSurface,
NumericAxis,
NumberRange,
XyDataSeries,
XyxyDataSeries,
FastLineRenderableSeries,
FastRectangleRenderableSeries,
XyScatterRenderableSeries,
EllipsePointMarker,
EColumnMode,
EColumnYMode,
EAxisAlignment,
HorizontalLineAnnotation,
VerticalLineAnnotation,
LegendModifier,
ELegendPlacement,
CursorModifier,
SciChartJsNavyTheme,
MouseWheelZoomModifier,
ZoomPanModifier,
ZoomExtentsModifier
} = SciChart;
// or, for npm, import { SciChartSurface, ... } from "scichart"

const theme = new SciChartJsNavyTheme();
const BLUE = "#50C7E0";
const ORANGE = "#F48420";
const GREY = "#C8D3E8";
const zoom = () => [new MouseWheelZoomModifier(), new ZoomPanModifier(), new ZoomExtentsModifier()];
const line = (wasmContext, dataSeries, stroke, options = {}) =>
new FastLineRenderableSeries(wasmContext, { dataSeries, stroke, strokeThickness: 2, ...options });
const dots = (wasmContext, dataSeries, fill, size) =>
new XyScatterRenderableSeries(wasmContext, {
dataSeries,
stroke: fill, // the colour shown in the legend
pointMarker: new EllipsePointMarker(wasmContext, { width: size, height: size, fill, stroke: "#FFFFFF", strokeThickness: 1 })
});
const dashed = { stroke: GREY, strokeThickness: 1, strokeDashArray: [3, 3] };
const zeroLineY = () => new HorizontalLineAnnotation({ y1: 0, ...dashed });
const zeroLineX = () => new VerticalLineAnnotation({ x1: 0, ...dashed });

// The zeros, found once: every zero up to height 5,600 (5,000 and more of them)
const zeros = findZeros(5600);

// --- 1. Hardy's Z(t): it crosses zero at every zero of zeta on the critical line ---
const hardy = await SciChartSurface.create(ui.hardy.chartDiv, { theme });
hardy.sciChartSurface.xAxes.add(new NumericAxis(hardy.wasmContext, { axisTitle: "t (height on the critical line)", labelPrecision: 0 }));
hardy.sciChartSurface.yAxes.add(new NumericAxis(hardy.wasmContext, { axisTitle: "Z(t)", axisAlignment: EAxisAlignment.Left, growBy: new NumberRange(0.05, 0.05) }));
const hardyData = new XyDataSeries(hardy.wasmContext, { dataSeriesName: "Z(t)", isSorted: true, containsNaN: false });
const hardyZeros = new XyDataSeries(hardy.wasmContext, { dataSeriesName: "Zeros", isSorted: true, containsNaN: false });
hardy.sciChartSurface.renderableSeries.add(line(hardy.wasmContext, hardyData, BLUE, { strokeThickness: 1.5 }), dots(hardy.wasmContext, hardyZeros, ORANGE, 7));
hardy.sciChartSurface.annotations.add(zeroLineY());
hardy.sciChartSurface.chartModifiers.add(
new LegendModifier({ showCheckboxes: false, placement: ELegendPlacement.TopRight }),
new CursorModifier({ showTooltip: true, showAxisLabels: false }),
...zoom()
);

function updateHardy() {
const T = Number(ui.hardy.control("range").value);
const step = T <= 100 ? 0.01 : T <= 1000 ? 0.02 : 0.05; // 5,000 to 100,000 points
const ts = [];
const zs = [];
for (let t = 0; t <= T + 1e-9; t += step) {
ts.push(t);
zs.push(hardyZ(t));
}
hardyData.clear();
hardyData.appendRange(ts, zs);
const shown = zeros.filter((g) => g <= T);
hardyZeros.clear();
hardyZeros.appendRange(shown, shown.map(() => 0));
hardy.sciChartSurface.zoomExtents();
ui.hardy.status.textContent =
`${ts.length.toLocaleString("en-GB")} points · ${shown.length.toLocaleString("en-GB")} zeros between 0 and ${T.toLocaleString("en-GB")}, ` +
`every one a sign change on the line · Riemann–von Mangoldt N(T) ≈ ${zeroCountEstimate(T).toFixed(1)}`;
}

// --- 2. The zeta spiral: the path of zeta(sigma + it) as t increases ---
const spiral = await SciChartSurface.create(ui.spiral.chartDiv, { theme });
spiral.sciChartSurface.xAxes.add(
new NumericAxis(spiral.wasmContext, { axisTitle: "Real part of ζ", visibleRange: new NumberRange(-2.5, 4.5) })
);
spiral.sciChartSurface.yAxes.add(
new NumericAxis(spiral.wasmContext, { axisTitle: "Imaginary part of ζ", axisAlignment: EAxisAlignment.Left, visibleRange: new NumberRange(-3, 3) })
);
// The path is not sorted in x, so tell the data series
const spiralData = new XyDataSeries(spiral.wasmContext, { dataSeriesName: "ζ(σ + it)", isSorted: false, containsNaN: false });
const spiralAtZeros = new XyDataSeries(spiral.wasmContext, { dataSeriesName: "At the zero heights", isSorted: false, containsNaN: false });
spiral.sciChartSurface.renderableSeries.add(line(spiral.wasmContext, spiralData, BLUE, { strokeThickness: 1.5 }), dots(spiral.wasmContext, spiralAtZeros, ORANGE, 9));
spiral.sciChartSurface.annotations.add(zeroLineY(), zeroLineX());
spiral.sciChartSurface.chartModifiers.add(new LegendModifier({ showCheckboxes: false, placement: ELegendPlacement.TopRight }), ...zoom());

function updateSpiral() {
const sigma = Number(ui.spiral.control("sigma").value);
const tMax = Number(ui.spiral.control("tmax").value);
ui.spiral.output("sigma").textContent = sigma.toFixed(2);
ui.spiral.output("tmax").textContent = String(tMax);
const re = [];
const im = [];
for (let t = 0; t <= tMax + 1e-9; t += 0.01) {
const z = zeta(cx(sigma, t));
re.push(z.re);
im.push(z.im);
}
spiralData.clear();
spiralData.appendRange(re, im);
// Where the path is at the height of each zero: on the origin only when sigma = 1/2
const heights = zeros.filter((g) => g <= tMax);
const atZeros = heights.map((g) => zeta(cx(sigma, g)));
spiralAtZeros.clear();
spiralAtZeros.appendRange(atZeros.map((z) => z.re), atZeros.map((z) => z.im));
const nearest = Math.min(...atZeros.map(cAbs));
ui.spiral.status.textContent =
Math.abs(sigma - 0.5) < 0.005
? `σ = 0.5: the path goes through 0 at all ${heights.length} zero heights up to t = ${tMax}`
: `σ = ${sigma.toFixed(2)}: the path misses 0; nearest approach at a zero height ${nearest.toFixed(3)}`;
}

// --- 3. The prime-counting function rebuilt from the zeros (Riemann's explicit formula) ---
const primesChart = await SciChartSurface.create(ui.primes.chartDiv, { theme });
primesChart.sciChartSurface.xAxes.add(
new NumericAxis(primesChart.wasmContext, { axisTitle: "x", labelPrecision: 0, visibleRange: new NumberRange(0, 100), visibleRangeLimit: new NumberRange(0, 100) })
);
primesChart.sciChartSurface.yAxes.add(
new NumericAxis(primesChart.wasmContext, { axisTitle: "Number of primes up to x", axisAlignment: EAxisAlignment.Left, labelPrecision: 0, visibleRange: new NumberRange(-4, 31) })
);
const X_MAX = 100;
const xs = Array.from({ length: 991 }, (_, i) => 1 + i * 0.1);
const primes = primesUpTo(X_MAX);
const MAX_ZEROS = 300;
const { smooth, perZero } = explicitFormulaTerms(xs, zeros.slice(0, MAX_ZEROS));
const stepX = [1, ...primes, X_MAX];
const stepY = [0, ...primes.map((_, i) => i + 1), primes.length];
const liX = xs.filter((x) => x >= 1.5);
primesChart.sciChartSurface.renderableSeries.add(
line(primesChart.wasmContext, new XyDataSeries(primesChart.wasmContext, { xValues: liX, yValues: liX.map(li), dataSeriesName: "li(x)" }), GREY, {
strokeDashArray: [6, 4]
}),
// isDigitalLine draws the steps of pi(x): flat between primes, up by one at each prime
line(primesChart.wasmContext, new XyDataSeries(primesChart.wasmContext, { xValues: stepX, yValues: stepY, dataSeriesName: "π(x), the true count" }), ORANGE, {
isDigitalLine: true
})
);
const formulaData = new XyDataSeries(primesChart.wasmContext, { dataSeriesName: "Explicit formula", isSorted: true, containsNaN: false });
primesChart.sciChartSurface.renderableSeries.add(line(primesChart.wasmContext, formulaData, BLUE));
primesChart.sciChartSurface.chartModifiers.add(
new LegendModifier({ showCheckboxes: false, placement: ELegendPlacement.TopLeft }),
new CursorModifier({ showTooltip: true, showAxisLabels: false }),
...zoom()
);

function updatePrimes() {
const count = Number(ui.primes.control("zeros").value);
ui.primes.output("zeros").textContent = String(count);
const ys = Float64Array.from(smooth);
for (let k = 0; k < count; k++) {
const row = perZero[k];
for (let i = 0; i < ys.length; i++) ys[i] += row[i];
}
formulaData.clear();
formulaData.appendRange(xs, Array.from(ys));
const at = (x) => ys[Math.round((x - 1) * 10)];
ui.primes.status.textContent =
count === 0
? "No zeros: a smooth curve, close to li(x), with no steps"
: `${count} zeros (up to height ${zeros[count - 1].toFixed(1)}) · formula at x = 50: ${at(50).toFixed(2)} (π = 15), at x = 100: ${at(100).toFixed(2)} (π = 25)`;
}

// --- 4. Gaps between neighbouring zeros against the GUE prediction from random-matrix theory ---
const gaps = await SciChartSurface.create(ui.spacings.chartDiv, { theme });
gaps.sciChartSurface.xAxes.add(
new NumericAxis(gaps.wasmContext, { axisTitle: "Gap ÷ average gap at that height", visibleRange: new NumberRange(0, 3) })
);
gaps.sciChartSurface.yAxes.add(new NumericAxis(gaps.wasmContext, { axisTitle: "Probability density", axisAlignment: EAxisAlignment.Left, visibleRange: new NumberRange(0, 1.2) }));
const histogramData = new XyxyDataSeries(gaps.wasmContext, { dataSeriesName: "Zeros" });
const sGrid = Array.from({ length: 301 }, (_, i) => i * 0.01);
gaps.sciChartSurface.renderableSeries.add(
new FastRectangleRenderableSeries(gaps.wasmContext, {
dataSeries: histogramData,
columnXMode: EColumnMode.StartEnd,
columnYMode: EColumnYMode.TopBottom,
fill: "#50C7E0CC",
stroke: BLUE,
strokeThickness: 1,
topCornerRadius: 2
}),
// Wigner surmise for the GUE: p(s) = (32 / pi^2) s^2 e^(-4 s^2 / pi)
line(
gaps.wasmContext,
new XyDataSeries(gaps.wasmContext, {
xValues: sGrid,
yValues: sGrid.map((s) => (32 / Math.PI ** 2) * s * s * Math.exp((-4 * s * s) / Math.PI)),
dataSeriesName: "GUE (Wigner surmise)"
}),
ORANGE,
{ strokeThickness: 3 }
),
// Independent random points (Poisson): p(s) = e^(-s)
line(
gaps.wasmContext,
new XyDataSeries(gaps.wasmContext, { xValues: sGrid, yValues: sGrid.map((s) => Math.exp(-s)), dataSeriesName: "Random points (Poisson)" }),
GREY,
{ strokeDashArray: [6, 4] }
)
);
gaps.sciChartSurface.chartModifiers.add(new LegendModifier({ showCheckboxes: false, placement: ELegendPlacement.TopRight }), ...zoom());

function updateGaps() {
const count = Number(ui.spacings.control("count").value);
const g = zeros.slice(0, count);
// Normalise each gap by the local average gap, 2 pi / ln(t / 2 pi), so the average is 1 at every height
const spacings = g.slice(1).map((next, i) => ((next - g[i]) * Math.log(g[i] / (2 * Math.PI))) / (2 * Math.PI));
const BIN = 0.1;
const counts = new Array(30).fill(0);
spacings.forEach((s) => s < 3 && counts[Math.floor(s / BIN)]++);
const density = counts.map((n) => n / (spacings.length * BIN));
histogramData.clear();
histogramData.appendRange(
counts.map((_, i) => i * BIN),
density,
counts.map((_, i) => (i + 1) * BIN),
density.map(() => 0)
);
const mean = spacings.reduce((a, b) => a + b, 0) / spacings.length;
const small = spacings.filter((s) => s < 0.2).length;
ui.spacings.status.textContent =
`${spacings.length.toLocaleString("en-GB")} gaps, average ${mean.toFixed(3)} · ` +
`${((100 * small) / spacings.length).toFixed(1)}% under 0.2 (random points: 18.1%)`;
}

const on = (panel, id, event, handler) => panel.control(id).addEventListener(event, handler);
on(ui.hardy, "range", "change", updateHardy);
on(ui.spiral, "sigma", "input", updateSpiral);
on(ui.spiral, "tmax", "input", updateSpiral);
on(ui.primes, "zeros", "input", updatePrimes);
on(ui.spacings, "count", "change", updateGaps);
updateHardy();
updateSpiral();
updatePrimes();
updateGaps();

Key points:

  • Z(t)Z(t) and the explicit formula are FastLineRenderableSeries; the prime staircase is the same series with isDigitalLine: true, which draws steps instead of slopes.
  • The zeta spiral is a line whose x values (the real part) go back and forth, so its XyDataSeries is created with isSorted: false.
  • The gap histogram is a FastRectangleRenderableSeries on an XyxyDataSeries, one rectangle per bin from its start to its end.
  • Sliders only change data: each update calls clear() and appendRange() on a data series, and the chart redraws. The explicit formula stores each zero's wave once, so moving the slider is just a sum.

See it in the demo app: JavaScript line chart · React line chart · Angular line chart; and for very large point counts, JavaScript chart with one million points · React chart with one million points · Angular chart with one million points.

Go deeper: SciChart.js line series documentation, the rectangle series documentation and the guides to the line chart, the histogram and the log scale graph, useful when you plot π(x)\pi(x) against li⁡(x)\operatorname{li}(x) up to millions.

Frequently asked questions​

What does the Riemann hypothesis say in simple terms?​

The Riemann zeta function is zero at two kinds of points. The trivial zeros are the negative even numbers -2, -4, -6 and so on. All the others, the non-trivial zeros, lie in a narrow vertical band of the complex plane between real part 0 and real part 1. The hypothesis says every one of these non-trivial zeros sits exactly on the centre line of that band, where the real part is 1/2.

Has the Riemann hypothesis been proven?​

Not as of November 2026. The Clay Mathematics Institute lists it as unsolved, with a one-million-dollar prize for a proof. Computers have checked more than 12 trillion zeros and found all of them on the critical line, but no number of checked cases proves a statement about infinitely many zeros. Claimed proofs appear from time to time, but none has been accepted.

What is the first non-trivial zero of the zeta function?​

The first non-trivial zero is at 1/2 + 14.134725...i, so its height on the critical line is about 14.134725. The next two are at heights 21.022040 and 25.010858. Every zero has a mirror image below the real axis, at 1/2 - 14.134725...i and so on. Andrew Odlyzko's tables and the LMFDB list the first zeros to many more decimal places.

Why does the Riemann hypothesis matter for prime numbers?​

Riemann's explicit formula writes the prime-counting function exactly as a smooth main term minus one wave for each zero of the zeta function. The real part of a zero sets how fast its wave grows. If every zero has real part 1/2, the primes stray from the logarithmic integral li(x) by no more than about the square root of x times log x, which is close to the best accuracy possible. A zero off the line would mean larger, more irregular deviations.

What is the critical line?​

The critical line is the vertical line of complex numbers with real part 1/2, written s = 1/2 + it. It runs down the middle of the critical strip, the band 0 < Re(s) < 1 that contains every non-trivial zeta zero. The functional equation makes the zeros symmetric about this line, and the Riemann hypothesis says they all lie on it.

How do I plot the Riemann zeta function in JavaScript?​

Compute Hardy's Z(t), a real function whose sign changes are the zeros on the critical line: evaluate zeta directly with Euler-Maclaurin summation for small t, and with the Riemann-Siegel formula for larger t. Draw Z(t) as a line series with the zeros as scatter points at y = 0. For the complex path of zeta, plot the real part against the imaginary part as an unsorted line. SciChart.js draws hundreds of thousands of points this way in plain JavaScript, React or Angular.

Sources​