The prime number theorem for the remainders `R_q`
New.Reduction.Zeros.PrimeNumberTheorem.lean
Reading
Upstream documentation written by Claude
Let
dbe a prime andq ≥ 1. The remainderR_q(y)is an integral of the error𝓔_q(t)in the weighted count (primeRemainder_eq_integral_countError_sub), so it varies slowly. For odddprime toqits absolute value is at most(log y) ^ (-B)for all largey, for every natural numberB; so it tends to0, which characterises the constantc_qin its definition.
Copyright 2026 Anthropic, PBC. Apache License 2.0 · Upstream notice.
Rest of upstream introduction
Notions from other files:
lambdaKResidueClass d q nisλ(n) = Λ(n) (1 - (n/d))forn ≡ 1modq, and0for othern.entireL ψisL(s, ψ), multiplied bys - 1ifψis principal;quadTwist ψ dis the product ofψand the Legendre symbol(·/d).logDerivMean d qis the functionG_qthat continues∑ λ(n) n ^ (-s) - s / (φ(q) (s - 1))whendis odd and prime toq.primeRemainder d q yisR_q(y) = ∑_{n ≤ y} λ(n) (1/n - 1/y) - log y / φ(q) - c_qwithc_q = re G_q(1).
Relation to the literature
Known result: Prime number theorem in arithmetic progressions with an error term that saves every
power of the logarithm. It is a case of the Siegel–Walfisz theorem. Source: Montgomery and Vaughan,
Multiplicative Number Theory I, 2007, Cor. 11.19. Form here: the modulus is fixed, and the count is
the smoothed sum ∑_{n ≤ y} λ(n) (1/n - 1/y) over the prime powers n ≡ 1 mod q; for d ≡ 3 mod
4 the primes that split in ℚ(√-d) have weight zero.
Declarations
lemma primeRemainder_eq_integral_countError_sub {y : ℝ} (hy : 1 ≤ y) : primeRemainder d q y = (∫ t in 1..y, countError d q t / t ^ 2) - re (logDerivMean d q 1)
Import route to Main
New.Reduction.Zeros.PrimeNumberTheorem → New.Reduction.OneSidedBound (pinned import) → New.Main (pinned import) → Main (pinned import)