RiemannA guide by Principia Superintelligence

Part I, chapter 2

From zeros to primes

A smoothed count of prime powers, G(x)G(x), whose only fluctuations are the waves left by the zeros of ζ\zeta. One zero off the line would be visible in the primes.

draft, under review14 minfirst published in v0.1.0, 2026-11-22

Counting prime powers with a ramp

Write Λ(n)=log⁡p\Lambda(n) = \log p if n=phn = p^{h} is a power of a prime and Λ(n)=0\Lambda(n) = 0 otherwise. Chebyshev’s function ψ(x)=∑n≤xΛ(n)\psi(x) = \sum_{n \le x} \Lambda(n) is the honest way to count primes: the prime number theorem is the statement ψ(x)∼x\psi(x) \sim x, and every finer statement about primes is a statement about ψ(x)−x\psi(x) - x.

The proof uses a smoothed version. Instead of counting each prime power once, weight it by the ramp

(xn−1)+=max⁡(xn−1, 0),\Big(\frac{x}{n} - 1\Big)_{+} = \max\Big(\frac{x}{n} - 1,\, 0\Big),

which is large for small nn, decreases, reaches zero at n=xn = x and stays zero after. Then

S(x)=∑n≤xΛ(n)(xn−1),S(x) = \sum_{n \le x} \Lambda(n)\Big(\frac{x}{n} - 1\Big), G(x)=S(x)−xlog⁡x+(1+γ) x,G(x) = S(x) - x\log x + (1 + \gamma)\, x,

where γ=0.5772…\gamma = 0.5772\ldots is Euler’s constant. The two subtracted terms are the main term of SS; what is left, GG, is a remainder. Everything the zeros know about the primes is in GG.

S(x)S(x) built ramp by ramp. Each prime power nn contributes a ramp of slope log⁡p/n\log p / n starting at x=nx = n. Subtracting xlog⁡x−(1+γ)xx\log x - (1+\gamma)x leaves G(x)G(x), which stays small.
Deduction.rampdefDedekindLFunctions/CharFamily.lean:10The ramp sum, with coefficient f(n)f(n) to allow a character later; max⁡(y/n−1,0)\max(y/n - 1, 0) is (y/n−1)+(y/n - 1)_+.
def ramp (f : ℕ → ℂ) (y : ℝ) : ℂ

The ramp sum, with coefficient f(n)f(n) to allow a character later; max⁡(y/n−1,0)\max(y/n - 1, 0) is (y/n−1)+(y/n - 1)_+.

Full declaration with proof
def ramp (f : ℕ → ℂ) (y : ℝ) : ℂ :=
  ∑ n ∈ Finset.range (⌊y⌋₊ + 1), (Λ n : ℂ) * f n * ((max (y / n - 1) 0 : ℝ) : ℂ)
Deduction.GdefDedekindLFunctions/CharFamily.lean:21GG for the trivial character. The archive also carries an earlier formulation, Formalism.G, with the same meaning; the route of the final theorem passes through the Deduction versions.
def G (y : ℝ) : ℝ

GG for the trivial character. The archive also carries an earlier formulation, Formalism.G, with the same meaning; the route of the final theorem passes through the Deduction versions.

Full declaration with proof
def G (y : ℝ) : ℝ :=
  (ramp (fun _ => 1) y).re - y * Real.log y + (1 + Real.eulerMascheroniConstant) * y

Why this statistic: a Mellin transform with simple poles

The ramp has a clean Mellin transform. For Re⁡s>1\operatorname{Re} s > 1,

∫1∞(xn−1)+x−s−1 dx=n−ss(s−1).\int_{1}^{\infty} \Big(\frac{x}{n} - 1\Big)_{+} x^{-s-1}\, dx = \frac{n^{-s}}{s(s-1)}.
Deduction.mellin_ramptheoremLandauTheorems/MellinRamp.lean:10Exactly that integral, for each n≥1n \ge 1 and Re⁡s>1\operatorname{Re} s > 1.
theorem mellin_ramp (n : ℕ) (hn : 1 ≤ n) (s : ℂ) (hs : 1 < s.re) :
    ∫ y in Ioi (1 : ℝ), ((max (y / n - 1) 0 : ℝ) : ℂ) * (y : ℂ) ^ (-s - 1) = (n : ℂ) ^ (-s) / (s * (s - 1))

Exactly that integral, for each n≥1n \ge 1 and Re⁡s>1\operatorname{Re} s > 1.

Full declaration with proof
theorem mellin_ramp (n : ℕ) (hn : 1 ≤ n) (s : ℂ) (hs : 1 < s.re) :
    ∫ y in Ioi (1 : ℝ), ((max (y / n - 1) 0 : ℝ) : ℂ) * (y : ℂ) ^ (-s - 1) = (n : ℂ) ^ (-s) / (s * (s - 1)) := by
  have hn0 : (0 : ℝ) < n := by exact_mod_cast hn
  have hn1 : (1 : ℝ) ≤ n := by exact_mod_cast hn
  have hs0 : s ≠ 0 := by
    intro h; rw [h] at hs; simp at hs; linarith
  have hs1 : s - 1 ≠ 0 := by
    intro h
    have : s = 1 := by linear_combination h
    rw [this] at hs; simp at hs
  have hnC : (n : ℂ) ≠ 0 := by exact_mod_cast hn0.ne'
  rw [setIntegral_eq_of_subset_of_forall_sdiff_eq_zero (s := Ioi (n : ℝ)) measurableSet_Ioi
    (Ioi_subset_Ioi hn1)]
  swap
  · intro y hy
    have hy' : y ≤ n := by simpa using hy.2
    have : y / n - 1 ≤ 0 := by
      rw [sub_nonpos, div_le_one hn0]; exact hy'
    simp [max_eq_right this]
  have hpt : ∀ y ∈ Ioi (n : ℝ), ((max (y / n - 1) 0 : ℝ) : ℂ) * (y : ℂ) ^ (-s - 1)
      = (n : ℂ)⁻¹ * (y : ℂ) ^ (-s) - (y : ℂ) ^ (-s - 1) := by
    intro y hy
    have hy : (n : ℝ) < y := hy
    have hypos : (0 : ℝ) < y := lt_trans hn0 hy
    have hyC : (y : ℂ) ≠ 0 := by exact_mod_cast hypos.ne'
    have hm : y / n - 1 ≥ 0 := by
      rw [ge_iff_le, sub_nonneg, le_div_iff₀ hn0]; linarith
    rw [max_eq_left hm, cpow_sub _ _ hyC, cpow_one]
    push_cast
    field_simp
  rw [setIntegral_congr_fun measurableSet_Ioi hpt]
  have ha1 : (-s).re < -1 := by simp; linarith
  have ha2 : (-s - 1).re < -1 := by simp; linarith
  rw [integral_sub ((integrableOn_Ioi_cpow_of_lt ha1 hn0).const_mul _)
    (integrableOn_Ioi_cpow_of_lt ha2 hn0), integral_const_mul,
    integral_Ioi_cpow_of_lt ha1 hn0, integral_Ioi_cpow_of_lt ha2 hn0]
  have hcast : ((n : ℝ) : ℂ) = (n : ℂ) := by push_cast; rfl
  rw [hcast, cpow_add _ _ hnC, cpow_one, sub_add_cancel]
  have h1s : -s + 1 ≠ 0 := by
    intro h; apply hs1; linear_combination -h
  field_simp
  ring

Summing against Λ(n)\Lambda(n) turns ∑nΛ(n)n−s\sum_n \Lambda(n) n^{-s} into −ζ′(s)/ζ(s)-\zeta'(s)/\zeta(s), so

F(s)=∫1∞G(x) x−s−1 dx=−ζ′(s)ζ(s)⋅1s(s−1)−1(s−1)2+1+γs−1.\begin{aligned} F(s) &= \int_{1}^{\infty} G(x)\, x^{-s-1}\, dx \\ &= -\frac{\zeta'(s)}{\zeta(s)}\cdot\frac{1}{s(s-1)} - \frac{1}{(s-1)^{2}} + \frac{1+\gamma}{s-1}. \end{aligned}

The last two terms cancel the pole at s=1s = 1 exactly; that is what the main term was chosen to do. What remains are simple poles of FF at the zeros ρ\rho of ζ\zeta, each with residue −1/(ρ(ρ−1))-1/(\rho(\rho - 1)) when the zero is simple, plus a pole at s=0s = 0 and poles at the trivial zeros. Shifting the contour in the inverse transform gives the explicit formula

G(x)=log⁡2π−∑ρxρρ(ρ−1)+O(x−2),G(x) = \log 2\pi - \sum_{\rho} \frac{x^{\rho}}{\rho(\rho - 1)} + O(x^{-2}),

the sum running over the non-trivial zeros. The sum converges absolutely because of the factor ρ(ρ−1)\rho(\rho-1) in the denominator; that is the benefit of smoothing. One has ∑ρ1/(ρ(1−ρ))=2+γ−log⁡4π=0.04619…\sum_\rho 1/(\rho(1-\rho)) = 2 + \gamma - \log 4\pi = 0.04619\ldots, so if every zero has real part 1/21/2 then ∣xρ∣=x|x^\rho| = \sqrt{x} for all of them and

∣G(x)−log⁡2π∣≤0.04619 x(x large).|G(x) - \log 2\pi| \le 0.04619\, \sqrt{x} \qquad (x \text{ large}).

This is a bound that assumes the hypothesis, not an envelope read off the data; the dashed lines in the figures below draw it with the constant rounded to 0.046190.04619, and the table shows how far inside it the computed values sit.

Formalism.LSeriesLamFdefFormalism/ZetaRealNonvanish.lean:37The Dirichlet-series identity behind the first step, for a real character: the LL-series of Λ(n)(1+Re⁡χ(n))\Lambda(n)(1 + \operatorname{Re}\chi(n)) is −ζ′/ζ−L′/L-\zeta'/\zeta - L'/L.
def LSeriesLamF : Prop

The Dirichlet-series identity behind the first step, for a real character: the LL-series of Λ(n)(1+Re⁡χ(n))\Lambda(n)(1 + \operatorname{Re}\chi(n)) is −ζ′/ζ−L′/L-\zeta'/\zeta - L'/L.

Full declaration with proof
def LSeriesLamF : Prop :=
  ∀ (N : ℕ) [NeZero N] (χ : DirichletCharacter ℂ N), (∀ n : ℕ, (χ n).im = 0) →
    ∀ s : ℂ, 1 < s.re →
      LSeries (fun n => (LamF χ n : ℂ)) s =
        -deriv riemannZeta s / riemannZeta s -
          deriv (DirichletCharacter.LFunction χ) s / DirichletCharacter.LFunction χ s

Watch the zeros build the primes

The curve below is G(x)G(x) computed from the prime powers up to two million, against the explicit formula truncated after kk zeros. With no zeros it is the constant log⁡2π=1.84\log 2\pi = 1.84. Each zero ρ=1/2+iγk\rho = 1/2 + i\gamma_k adds the wave −2Re⁡(xρ/(ρ(ρ−1)))=−2x∣ρ(ρ−1)∣cos⁡(γklog⁡x−ϕk)-2\operatorname{Re}\big(x^{\rho}/(\rho(\rho-1))\big) = -\tfrac{2\sqrt{x}}{|\rho(\rho-1)|}\cos(\gamma_k \log x - \phi_k): a cosine in log⁡x\log x with amplitude growing like x\sqrt{x}. Two hundred zeros reproduce the primes to within a thousandth of x\sqrt{x}.

-20-10010201010010^310^410^510^6x (log scale)
grey: G(x) summed over prime powers · crimson: log 2π − Σρ xρ/(ρ(ρ−1)) over the first 200 zeros · dashed: ±0.04619√x, the bound if every zero is on the line

A sanity check on real primes, from the same data as the figure:

xG(x)0.04619 √x
10,0001.7494.6
100,0003.67114.6
1,000,00011.04046.2
2,000,000-12.26865.3

What a zero off the line would do

Suppose some zero had real part β>1/2\beta > 1/2. It and its conjugate contribute a term of size about 2xβ/∣ρ(ρ−1)∣2 x^{\beta}/|\rho(\rho-1)| to G(x)G(x), oscillating in log⁡x\log x with both signs. For large xx this dwarfs the 0.04619x0.04619\sqrt{x} from all the zeros on the line, so G(x)G(x) would exceed c xβc\, x^{\beta} for some c>0c > 0 at arbitrarily large xx. Contrapositively: if G(x)≤xθG(x) \le x^{\theta} for all large xx, there is no zero with real part greater than θ\theta. That is the direction the proof needs, and it is weaker than it looks: an upper bound alone suffices, because of the oscillation. Making this rigorous, and weakening “all large xx” to sparse windows, is the content of the next two chapters.

Try it. The amber curve below adds one hypothetical pair of zeros at β±iγ\beta \pm i\gamma to the two hundred real ones and shows what the primes would have to do. What moves and what stays: the grey curve is G(x)G(x) measured from the prime powers up to two million and never changes; the two hundred real zeros stay where they are; only the amber curve, which adds the single hypothetical pair with amplitude 2xβ/∣ρ(ρ−1)∣2x^{\beta}/|\rho(\rho-1)|, responds to the sliders.

-300-200-10001002003001010010^310^410^510^6x (log scale)

grey: G(x) from the primes · crimson: the first 200 zeros · amber: the same with the extra pair, whose wave has amplitude 2·x^β / |ρ(ρ − 1)| (dashed). At x = 10⁶ that amplitude is 143.3, against 46.2 for everything on the line. Any upper bound of the form x^θ with θ < β is broken infinitely often: the wave takes both signs.

The same statistic for a Dirichlet character

For a primitive character χ≠1\chi \ne 1 put Gχ(x)=∑n≤xΛ(n)χ(n)(x/n−1)+x L′L(1,χ)G_\chi(x) = \sum_{n \le x} \Lambda(n)\chi(n)(x/n - 1) + x\, \frac{L'}{L}(1,\chi). There is no xlog⁡xx \log x term because L(s,χ)L(s,\chi) has no pole at 11; the linear term is again chosen to cancel the constant in the Laurent expansion. The archive defines both cases in one function, , with the trivial character handled by the if.

Where this is in the exposition and in the archive

This chapter follows the exposition, §I.1 and Part II §1, with the numbers recomputed by our scripts (tools/rh_tools/numerics.py). The Lean side lives in Development/AutomorphicArithmetic/DedekindLFunctions/CharFamily.lean and LandauTheorems/MellinRamp.lean, with the earlier formulation in Formalism/Statement.lean and Formalism/ZetaRealNonvanish.lean.

Formalism.SdefFormalism/Statement.lean:14
def S {N : ℕ} (χ : DirichletCharacter ℂ N) (x : ℝ) : ℝ
Full declaration with proof
def S {N : ℕ} (χ : DirichletCharacter ℂ N) (x : ℝ) : ℝ :=
  ∑ n ∈ Finset.Icc 1 ⌊x⌋₊, LamF χ n * (x / n - 1)
Formalism.GdefFormalism/Statement.lean:21
def G {N : ℕ} [NeZero N] (χ : DirichletCharacter ℂ N) (x : ℝ) : ℝ
Full declaration with proof
def G {N : ℕ} [NeZero N] (χ : DirichletCharacter ℂ N) (x : ℝ) : ℝ :=
  S χ x - x * Real.log x + (1 + gammaF χ) * x