Problems / erdos-1094 / erdos-1094--h3--h3
Granville–Ramaré: a carry at some prime p in (k/2, 11k/20)
erdos-1094--h3--h3
open
Hole h_gr of erdos-1094--h3 (split by 20261015T125200Z-t1015b-g-partial.lean).
$\displaystyle \forall C\in\mathbb{N}\ \exists K_2\ \forall n,k\in\mathbb{N}:\quad K_2<k,\ \ k^2\le C\cdot n\cdot\lfloor\log_2 k\rfloor,\ \ n<k^2 \implies \exists\,p \text{ prime},\ \tfrac{k}{2}<p<\tfrac{11k}{20},\ \ n \bmod p < k \bmod p$
For every constant $C$ there is a threshold $K_2$ such that for all $k>K_2$ and all $n<k^2$ with $k^2\le C\,n\lfloor\log_2 k\rfloor$ (the range $n\gg k^2/\log k$ that the ELS bound leaves), some prime $p$ with $k<2p$ and $20p<11k$ has $n \bmod p<k \bmod p$, a carry at the last base-$p$ digit. Everything is in $\mathbb{N}$: Nat.log 2 k is $\lfloor\log_2 k\rfloor$ (and $0$ for $k\le 1$), a natural number, so the right-hand side is a product of naturals, and n % p is the least non-negative residue.
Lean
theorem erdos_1094__h3__h3 : ∀ (C : ℕ),
∃ (K₂ : ℕ),
∀ (n k : ℕ),
K₂ < k →
k * k ≤ C * (n * Nat.log (2 : ℕ) k) →
n < k * k → ∃ (p : ℕ), Nat.Prime p ∧ k < (2 : ℕ) * p ∧ (20 : ℕ) * p < (11 : ℕ) * k ∧ n % p < k % p := by
sorryWhy does it end in sorry?
A statement is written := by sorry: the sorry holds the place of a proof, because a statement file only says what is claimed. A proof the gate checked is its own file, Proof.lean. How to read a proof page →
How it is being proved
Open. A direct proof, or proofs of its holes, close it.
Proved from these holes by 20261015T132200Z-t1015b-g-partial.lean (merged in 0f3cc6356058, attestation 000542).
h_cheb→ erdos-1094--h3--h3--h1 (open)$\displaystyle \exists K_3\in\mathbb{N}\ \forall k\in\mathbb{N}:\quad K_3<k \implies \frac{k}{100} \le \sum_{\substack{p \text{ prime}\\ k/2<p<11k/20}} \log p$
h_sander→ erdos-1094--h3--h3--h2 (open)$\displaystyle \forall C\in\mathbb{N},\ \varepsilon>0\ \exists K_4\ \forall n,k\in\mathbb{N}:\quad K_4<k,\ \ k^2\le C\cdot n\cdot\lfloor\log_2 k\rfloor,\ \ n<k^2 \implies \Bigl|\sum_{\substack{p \text{ prime}\\ k/2<p<11k/20}} \Bigl(\Bigl\{\frac{n}{p}\Bigr\}-\frac12\Bigr)\log p\Bigr| \le \varepsilon k$
Read the partial proof (Lean)
theorem erdos_1094__h3__h3 : ∀ (C : ℕ),
∃ (K₂ : ℕ),
∀ (n k : ℕ),
K₂ < k →
k * k ≤ C * (n * Nat.log (2 : ℕ) k) →
n < k * k → ∃ (p : ℕ), Nat.Prime p ∧ k < (2 : ℕ) * p ∧ (20 : ℕ) * p < (11 : ℕ) * k ∧ n % p < k % p := by
-- annex: 88f9e9a7ddffdc9d2a479880cf6eaa066f94ea7f17936fe431b479452d6c05bd
-- Second level of Granville–Ramaré, Mathematika 43 (1996) 73–107, Theorem 8, §5e
-- (preprint pp. 24–25), the analytic step. Suppose no prime p in (k/2, 11k/20) has a
-- last-digit carry; then {n/p} ≥ k/p − 1 > 9/11 for each such p (GR read the same
-- no-carry condition as {m/p} < 1/5 with m = n − k), so Σ ({n/p} − 1/2) log p is
-- ≥ (7/22) Σ log p, which h_cheb makes ≫ k and h_sander makes o(k).
-- h_cheb: the "≫ k" of p. 25, used and not proved by GR: Σ_{k/2<p<11k/20} log p ≫ k,
-- the prime number theorem on (x, 1.1x) (θ(1.1x) − θ(x) ~ x/10 with x = k/2).
have h_cheb : ∃ K₃ : ℕ, ∀ k : ℕ, K₃ < k →
(k : ℝ) / 100 ≤ ∑ p ∈ (Finset.range k).filter (fun p => p.Prime ∧ k < 2 * p ∧ 20 * p < 11 * k),
Real.log p := by
sorry
-- h_sander: GR's (5.1) (p. 18; the J = 1 case of their Lemma 5.1, taken from Sander [Sa2],
-- J. reine angew. Math. 430) on the interval (k/2, 11k/20), with its error terms o(k) on
-- this node's range (k² ≪ n log k, n < k²). Applied at x = n rather than GR's n − k: (5.1)
-- is uniform in x. Written with {t} − 1/2 in place of GR's ψ(t) (ψ is 0 at integers); the two
-- differ only at primes p | n, at most two in (k/2, k] when n < k² and k > 8, so O(log k).
have h_sander : ∀ (C : ℕ) (ε : ℝ), 0 < ε → ∃ K₄ : ℕ, ∀ n k : ℕ, K₄ < k →
k * k ≤ C * (n * Nat.log 2 k) → n < k * k →
|∑ p ∈ (Finset.range k).filter (fun p => p.Prime ∧ k < 2 * p ∧ 20 * p < 11 * k),
(Int.fract ((n : ℝ) / p) - 1 / 2) * Real.log p| ≤ ε * k := by
sorry
intro C
obtain ⟨K₃, hc⟩ := h_cheb
obtain ⟨K₄, hs⟩ := h_sander C (1 / 1000) (by norm_num)
refine ⟨max K₃ K₄, fun n k hk hlow hup => ?_⟩
have hk3 : K₃ < k := lt_of_le_of_lt (le_max_left _ _) hk
have hk4 : K₄ < k := lt_of_le_of_lt (le_max_right _ _) hk
by_contra hno
push_neg at hno
set S := (Finset.range k).filter (fun p => p.Prime ∧ k < 2 * p ∧ 20 * p < 11 * k) with hS
have hterm : ∀ p ∈ S, (7 / 22 : ℝ) * Real.log p ≤ (Int.fract ((n : ℝ) / p) - 1 / 2) * Real.log p := by
intro p hp
rw [hS, Finset.mem_filter] at hp
obtain ⟨-, hpr, h2p, h20⟩ := hp
have hmod := hno p hpr h2p h20
have hpk : p ≤ k := by omega
have hkp : k % p = k - p := by
rw [Nat.mod_eq_sub_mod hpk, Nat.mod_eq_of_lt (by omega)]
have hp0 : (0 : ℝ) < p := by exact_mod_cast hpr.pos
have hfr : Int.fract ((n : ℝ) / p) = ((n % p : ℕ) : ℝ) / p := Int.fract_div_natCast_eq_div_natCast_mod
have hge : ((k - p : ℕ) : ℝ) ≤ ((n % p : ℕ) : ℝ) := by exact_mod_cast (hkp ▸ hmod)
have hsub : ((k - p : ℕ) : ℝ) = (k : ℝ) - p := by
rw [Nat.cast_sub hpk]
have h20r : (20 : ℝ) * p < 11 * k := by exact_mod_cast h20
have hfrac : (9 / 11 : ℝ) ≤ Int.fract ((n : ℝ) / p) := by
rw [hfr, le_div_iff₀ hp0]
linarith
have hlog : 0 ≤ Real.log p := Real.log_natCast_nonneg p
nlinarith
have hsum : (7 / 22 : ℝ) * ∑ p ∈ S, Real.log p ≤
∑ p ∈ S, (Int.fract ((n : ℝ) / p) - 1 / 2) * Real.log p := by
rw [Finset.mul_sum]
exact Finset.sum_le_sum hterm
have hc' := hc k hk3
have hs' := hs n k hk4 hlow hup
have habs := le_abs_self (∑ p ∈ S, (Int.fract ((n : ℝ) / p) - 1 / 2) * Real.log p)
have hkpos : (0 : ℝ) < k := by exact_mod_cast (show 0 < k by omega)
linarithThe gate replayed this file at its merge, each hole a sorry (D-12 #5); the whole file: targets/erdos-1094/nodes/erdos-1094--h3--h3/attempts/20261015T132200Z-t1015b-g-partial.lean
Closing it through its holes
Closable through its holes: once they are proved, a proof of this statement may name their theorems, which its Context already carries. A direct proof is accepted at any time.
What is known
Work on it
Plans
- The analytic step of Granville–Ramaré's Theorem 8 (§5e, pp. — followed by 20261015T132200Z-t1015b-g-partial.lean · full text →
How to contribute → · Pull requests in flight ↗ · See it in the problem’s graph →
Record
Statement: the Lean file and its words (1 version)
Statement not audited — only a problem’s root statement is audited for fidelity (D-9); the kernel checks a proof against this Lean as written.
import Mathlib
import Nodes.«erdos-1094--h3--h3».Context
open scoped Nat
/-! Hole `h_gr` of a merged partial proof, as a node (D-12 #5, D-29).
Statement generated by the gate from the assembly; immutable (D-3). -/
theorem erdos_1094__h3__h3 : ∀ (C : ℕ),
∃ (K₂ : ℕ),
∀ (n k : ℕ),
K₂ < k →
k * k ≤ C * (n * Nat.log (2 : ℕ) k) →
n < k * k → ∃ (p : ℕ), Nat.Prime p ∧ k < (2 : ℕ) * p ∧ (20 : ℕ) * p < (11 : ℕ) * k ∧ n % p < k % p := by
sorryA statement is written := by sorry: the sorry holds the place of a proof, because a statement file only says what is claimed. A proof the gate checked is its own file, Proof.lean. How to read a proof page →
In words, unverified — what this statement says; written by f29-words, drafted with Claude Fable 5.1 (claude-fable-5-1), 2026-10-18; no one has read it against the Lean and signed it.
Draft · drafted, by the model named above
$\displaystyle \forall C\in\mathbb{N}\ \exists K_2\ \forall n,k\in\mathbb{N}:\quad K_2<k,\ \ k^2\le C\cdot n\cdot\lfloor\log_2 k\rfloor,\ \ n<k^2 \implies \exists\,p \text{ prime},\ \tfrac{k}{2}<p<\tfrac{11k}{20},\ \ n \bmod p < k \bmod p$
For every constant $C$ there is a threshold $K_2$ such that for all $k>K_2$ and all $n<k^2$ with $k^2\le C\,n\lfloor\log_2 k\rfloor$ (the range $n\gg k^2/\log k$ that the ELS bound leaves), some prime $p$ with $k<2p$ and $20p<11k$ has $n \bmod p<k \bmod p$, a carry at the last base-$p$ digit. Everything is in $\mathbb{N}$: Nat.log 2 k is $\lfloor\log_2 k\rfloor$ (and $0$ for $k\le 1$), a natural number, so the right-hand side is a product of naturals, and n % p is the least non-negative residue.
Rendered from gloss/db10fba82234….md · Improve these words →
Rendered from targets/erdos-1094/nodes/erdos-1094--h3--h3/Statement.lean. Origin: skeleton-hole.
Depends on (2), each in words
Depends on, each in words where someone has written them:
- erdos-1094--h3--h3--h1: $\exists K_3\in\mathbb{N}\ \forall k\in\mathbb{N}:\quad K_3<k \implies \frac{k}{100} \le \sum_{\substack{p \text{ prime}\\ k/2<p<11k/20}} \log p$
- erdos-1094--h3--h3--h2: $\forall C\in\mathbb{N},\ \varepsilon>0\ \exists K_4\ \forall n,k\in\mathbb{N}:\quad K_4<k,\ \ k^2\le C\cdot n\cdot\lfloor\log_2 k\rfloor,\ \ n<k^2 \implies \Bigl|\sum_{\substack{p \text{ prime}\\ k/2<p<11k/20}} \Bigl(\Bigl\{\frac{n}{p}\Bigr\}-\frac12\Bigr)\log p\Bigr| \le \varepsilon k$
Attestation: none of a proof
No proof of this statement has been merged. A partial assembly merged under attestations/000542.json: it records an attempt, not a proof (see Attempts below).
Witness
Not checked — no run on this page records step 7 passing for it.
0dbf380a6878.import Mathlib open scoped Nat theorem witness : ∃ (C : ℕ), True := ⟨0, trivial⟩
No gloss yet: no one has written in words what this witness says (D-3 v3.30); the Lean above is the witness. How to write one →
Attempts (1)
1 recorded. Routes refuted: none. Failure classes: none.
Untrusted contributor text — a partial assembly: it records an attempt, not a proof; its attestation names the file, and no hash in the record binds these bytes.
Untrusted: partial assembly (D-12 #5), by t1015b-g; merged in 0f3cc6356058 under attestations/000542.json, whose step 2 took this file as a partial. A partial records an attempt, not a proof: the gate replayed it with its holes left as sorry. Rendered from targets/erdos-1094/nodes/erdos-1094--h3--h3/attempts/20261015T132200Z-t1015b-g-partial.lean.
Untrusted contributor text — an outline the gate extracted from this partial assembly; its holes are sorry steps, and it records an attempt, not a proof.
Outline of 20261015T132200Z-t1015b-g-partial.lean, extracted by the gate at fa0a13ba270d from the proof’s elaboration: each step is a claim the proof establishes and the goal it leaves. Open a step for what it uses and its Lean lines.
h_chebhole∃ (K₃ : ℕ), ∀ (k : ℕ), K₃ < k → (↑k : ℝ) / (100 : ℝ) ≤ ∑ p ∈ Finset.range k with Nat.Prime p ∧ k < (2 : ℕ) * p ∧ (20 : ℕ) * p < (11 : ℕ) * k, Real.log (↑p : ℝ)holeLeaves
∀ (C : ℕ), ∃ (K₂ : ℕ), ∀ (n k : ℕ), K₂ < k → k * k ≤ C * (n * Nat.log (2 : ℕ) k) → n < k * k → ∃ (p : ℕ), Nat.Prime p ∧ k < (2 : ℕ) * p ∧ (20 : ℕ) * p < (11 : ℕ) * k ∧ n % p < k % p, withh_cheb : ∃ (K₃ : ℕ), ∀ (k : ℕ), K₃ < k → (↑k : ℝ) / (100 : ℝ) ≤ ∑ p ∈ Finset.range k with Nat.Prime p ∧ k < (2 : ℕ) * p ∧ (20 : ℕ) * p < (11 : ℕ) * k, Real.log (↑p : ℝ).Uses library
Finset.rangerange nis the set of natural numbers less thann. ,Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. .Left open as a hole; its statement is erdos-1094--h3--h3--h1 (open).
Lean, lines 23–26
have h_cheb : ∃ K₃ : ℕ, ∀ k : ℕ, K₃ < k → (k : ℝ) / 100 ≤ ∑ p ∈ (Finset.range k).filter (fun p => p.Prime ∧ k < 2 * p ∧ 20 * p < 11 * k), Real.log p := by sorryh_sanderhole∀ (C : ℕ) (ε : ℝ), (0 : ℝ) < ε → ∃ (K₄ : ℕ), ∀ (n k : ℕ), K₄ < k → k * k ≤ C * (n * Nat.log (2 : ℕ) k) → n < k * k → |∑ p ∈ Finset.range k with Nat.Prime p ∧ k < (2 : ℕ) * p ∧ (20 : ℕ) * p < (11 : ℕ) * k, (Int.fract ((↑n : ℝ) / (↑p : ℝ)) - (1 / 2 : ℝ)) * Real.log (↑p : ℝ)| ≤ ε * (↑k : ℝ)holeLeaves
∀ (C : ℕ), ∃ (K₂ : ℕ), ∀ (n k : ℕ), K₂ < k → k * k ≤ C * (n * Nat.log (2 : ℕ) k) → n < k * k → ∃ (p : ℕ), Nat.Prime p ∧ k < (2 : ℕ) * p ∧ (20 : ℕ) * p < (11 : ℕ) * k ∧ n % p < k % p, withh_sander : ∀ (C : ℕ) (ε : ℝ), (0 : ℝ) < ε → ∃ (K₄ : ℕ), ∀ (n k : ℕ), K₄ < k → k * k ≤ C * (n * Nat.log (2 : ℕ) k) → n < k * k → |∑ p ∈ Finset.range k with Nat.Prime p ∧ k < (2 : ℕ) * p ∧ (20 : ℕ) * p < (11 : ℕ) * k, (Int.fract ((↑n : ℝ) / (↑p : ℝ)) - (1 / 2 : ℝ)) * Real.log (↑p : ℝ)| ≤ ε * (↑k : ℝ).Uses library
Nat.loglog b n, is the logarithm of natural numbernin baseb. ,Finset.rangerange nis the set of natural numbers less thann. ,Int.fractInt.fract athe fractional part ofa, isaminus its floor. ,Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. .Left open as a hole; its statement is erdos-1094--h3--h3--h2 (open).
Lean, lines 32–36
have h_sander : ∀ (C : ℕ) (ε : ℝ), 0 < ε → ∃ K₄ : ℕ, ∀ n k : ℕ, K₄ < k → k * k ≤ C * (n * Nat.log 2 k) → n < k * k → |∑ p ∈ (Finset.range k).filter (fun p => p.Prime ∧ k < 2 * p ∧ 20 * p < 11 * k), (Int.fract ((n : ℝ) / p) - 1 / 2) * Real.log p| ≤ ε * k := by sorrys3obtain∃ (K₃ : ℕ), ∀ (k : ℕ), K₃ < k → (↑k : ℝ) / (100 : ℝ) ≤ ∑ p ∈ Finset.range k with Nat.Prime p ∧ k < (2 : ℕ) * p ∧ (20 : ℕ) * p < (11 : ℕ) * k, Real.log (↑p : ℝ)Leaves
∃ (K₂ : ℕ), ∀ (n k : ℕ), K₂ < k → k * k ≤ C * (n * Nat.log (2 : ℕ) k) → n < k * k → ∃ (p : ℕ), Nat.Prime p ∧ k < (2 : ℕ) * p ∧ (20 : ℕ) * p < (11 : ℕ) * k ∧ n % p < k % p, withK₃ : ℕ,hc : ∀ (k : ℕ), K₃ < k → (↑k : ℝ) / (100 : ℝ) ≤ ∑ p ∈ Finset.range k with Nat.Prime p ∧ k < (2 : ℕ) * p ∧ (20 : ℕ) * p < (11 : ℕ) * k, Real.log (↑p : ℝ).Lean, line 38
obtain ⟨K₃, hc⟩ := h_cheb
s4obtain∃ (K₄ : ℕ), ∀ (n k : ℕ), K₄ < k → k * k ≤ C * (n * Nat.log (2 : ℕ) k) → n < k * k → |∑ p ∈ Finset.range k with Nat.Prime p ∧ k < (2 : ℕ) * p ∧ (20 : ℕ) * p < (11 : ℕ) * k, (Int.fract ((↑n : ℝ) / (↑p : ℝ)) - (1 / 2 : ℝ)) * Real.log (↑p : ℝ)| ≤ (1 / 1000 : ℝ) * (↑k : ℝ)Leaves
∃ (K₂ : ℕ), ∀ (n k : ℕ), K₂ < k → k * k ≤ C * (n * Nat.log (2 : ℕ) k) → n < k * k → ∃ (p : ℕ), Nat.Prime p ∧ k < (2 : ℕ) * p ∧ (20 : ℕ) * p < (11 : ℕ) * k ∧ n % p < k % p, withK₄ : ℕ,hs : ∀ (n k : ℕ), K₄ < k → k * k ≤ C * (n * Nat.log (2 : ℕ) k) → n < k * k → |∑ p ∈ Finset.range k with Nat.Prime p ∧ k < (2 : ℕ) * p ∧ (20 : ℕ) * p < (11 : ℕ) * k, (Int.fract ((↑n : ℝ) / (↑p : ℝ)) - (1 / 2 : ℝ)) * Real.log (↑p : ℝ)| ≤ (1 / 1000 : ℝ) * (↑k : ℝ).Lean, line 39
obtain ⟨K₄, hs⟩ := h_sander C (1 / 1000) (by norm_num)
hk3haveK₃ < kLeaves
∃ (p : ℕ), Nat.Prime p ∧ k < (2 : ℕ) * p ∧ (20 : ℕ) * p < (11 : ℕ) * k ∧ n % p < k % p, withhk3 : K₃ < k.Uses library
lt_of_le_of_lt,le_max_left.Lean, line 41
have hk3 : K₃ < k := lt_of_le_of_lt (le_max_left _ _) hk
hk4haveK₄ < kLeaves
∃ (p : ℕ), Nat.Prime p ∧ k < (2 : ℕ) * p ∧ (20 : ℕ) * p < (11 : ℕ) * k ∧ n % p < k % p, withhk4 : K₄ < k.Uses library
lt_of_le_of_lt,le_max_right.Lean, line 42
have hk4 : K₄ < k := lt_of_le_of_lt (le_max_right _ _) hk
htermhave∀ p ∈ S, (7 / 22 : ℝ) * Real.log (↑p : ℝ) ≤ (Int.fract ((↑n : ℝ) / (↑p : ℝ)) - (1 / 2 : ℝ)) * Real.log (↑p : ℝ)Leaves
False, withhterm : ∀ p ∈ S, (7 / 22 : ℝ) * Real.log (↑p : ℝ) ≤ (Int.fract ((↑n : ℝ) / (↑p : ℝ)) - (1 / 2 : ℝ)) * Real.log (↑p : ℝ).Uses library
Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. ,Int.fractInt.fract athe fractional part ofa, isaminus its floor. ,Finset.mem_filter.Lean, lines 46–64
have hterm : ∀ p ∈ S, (7 / 22 : ℝ) * Real.log p ≤ (Int.fract ((n : ℝ) / p) - 1 / 2) * Real.log p := by intro p hp rw [hS, Finset.mem_filter] at hp obtain ⟨-, hpr, h2p, h20⟩ := hp have hmod := hno p hpr h2p h20 have hpk : p ≤ k := by omega have hkp : k % p = k - p := by rw [Nat.mod_eq_sub_mod hpk, Nat.mod_eq_of_lt (by omega)] have hp0 : (0 : ℝ) < p := by exact_mod_cast hpr.pos have hfr : Int.fract ((n : ℝ) / p) = ((n % p : ℕ) : ℝ) / p := Int.fract_div_natCast_eq_div_natCast_mod have hge : ((k - p : ℕ) : ℝ) ≤ ((n % p : ℕ) : ℝ) := by exact_mod_cast (hkp ▸ hmod) have hsub : ((k - p : ℕ) : ℝ) = (k : ℝ) - p := by rw [Nat.cast_sub hpk] have h20r : (20 : ℝ) * p < 11 * k := by exact_mod_cast h20 have hfrac : (9 / 11 : ℝ) ≤ Int.fract ((n : ℝ) / p) := by rw [hfr, le_div_iff₀ hp0] linarith have hlog : 0 ≤ Real.log p := Real.log_natCast_nonneg p nlinarithhterm.s1obtainp ∈ Finset.range k ∧ Nat.Prime p ∧ k < (2 : ℕ) * p ∧ (20 : ℕ) * p < (11 : ℕ) * kLeaves
(7 / 22 : ℝ) * Real.log (↑p : ℝ) ≤ (Int.fract ((↑n : ℝ) / (↑p : ℝ)) - (1 / 2 : ℝ)) * Real.log (↑p : ℝ), withhpr : Nat.Prime p,h2p : k < (2 : ℕ) * p,h20 : (20 : ℕ) * p < (11 : ℕ) * k.Lean, line 49
obtain ⟨-, hpr, h2p, h20⟩ := hp
hterm.hmodhavek % p ≤ n % pLeaves
(7 / 22 : ℝ) * Real.log (↑p : ℝ) ≤ (Int.fract ((↑n : ℝ) / (↑p : ℝ)) - (1 / 2 : ℝ)) * Real.log (↑p : ℝ), withhmod : k % p ≤ n % p.Lean, line 50
have hmod := hno p hpr h2p h20
hterm.hpkhavep ≤ kroutine: omegaLeaves
(7 / 22 : ℝ) * Real.log (↑p : ℝ) ≤ (Int.fract ((↑n : ℝ) / (↑p : ℝ)) - (1 / 2 : ℝ)) * Real.log (↑p : ℝ), withhpk : p ≤ k.Lean, line 51
have hpk : p ≤ k := by omega
hterm.hkphavek % p = k - pLeaves
(7 / 22 : ℝ) * Real.log (↑p : ℝ) ≤ (Int.fract ((↑n : ℝ) / (↑p : ℝ)) - (1 / 2 : ℝ)) * Real.log (↑p : ℝ), withhkp : k % p = k - p.Uses library
Nat.mod_eq_sub_mod,Nat.mod_eq_of_lt.Lean, lines 52–53
have hkp : k % p = k - p := by rw [Nat.mod_eq_sub_mod hpk, Nat.mod_eq_of_lt (by omega)]hterm.hp0have(0 : ℝ) < (↑p : ℝ)Leaves
(7 / 22 : ℝ) * Real.log (↑p : ℝ) ≤ (Int.fract ((↑n : ℝ) / (↑p : ℝ)) - (1 / 2 : ℝ)) * Real.log (↑p : ℝ), withhp0 : (0 : ℝ) < (↑p : ℝ).Lean, line 54
have hp0 : (0 : ℝ) < p := by exact_mod_cast hpr.pos
hterm.hfrhaveInt.fract ((↑n : ℝ) / (↑p : ℝ)) = (↑(n % p) : ℝ) / (↑p : ℝ)Leaves
(7 / 22 : ℝ) * Real.log (↑p : ℝ) ≤ (Int.fract ((↑n : ℝ) / (↑p : ℝ)) - (1 / 2 : ℝ)) * Real.log (↑p : ℝ), withhfr : Int.fract ((↑n : ℝ) / (↑p : ℝ)) = (↑(n % p) : ℝ) / (↑p : ℝ).Uses library
Int.fractInt.fract athe fractional part ofa, isaminus its floor. ,Int.fract_div_natCast_eq_div_natCast_mod.Lean, line 55
have hfr : Int.fract ((n : ℝ) / p) = ((n % p : ℕ) : ℝ) / p := Int.fract_div_natCast_eq_div_natCast_mod
hterm.hgehave(↑(k - p) : ℝ) ≤ (↑(n % p) : ℝ)Leaves
(7 / 22 : ℝ) * Real.log (↑p : ℝ) ≤ (Int.fract ((↑n : ℝ) / (↑p : ℝ)) - (1 / 2 : ℝ)) * Real.log (↑p : ℝ), withhge : (↑(k - p) : ℝ) ≤ (↑(n % p) : ℝ).Lean, line 56
have hge : ((k - p : ℕ) : ℝ) ≤ ((n % p : ℕ) : ℝ) := by exact_mod_cast (hkp ▸ hmod)
hterm.hsubhave(↑(k - p) : ℝ) = (↑k : ℝ) - (↑p : ℝ)Leaves
(7 / 22 : ℝ) * Real.log (↑p : ℝ) ≤ (Int.fract ((↑n : ℝ) / (↑p : ℝ)) - (1 / 2 : ℝ)) * Real.log (↑p : ℝ), withhsub : (↑(k - p) : ℝ) = (↑k : ℝ) - (↑p : ℝ).Uses library
Nat.cast_sub.Lean, lines 57–58
have hsub : ((k - p : ℕ) : ℝ) = (k : ℝ) - p := by rw [Nat.cast_sub hpk]hterm.h20rhave(20 : ℝ) * (↑p : ℝ) < (11 : ℝ) * (↑k : ℝ)Leaves
(7 / 22 : ℝ) * Real.log (↑p : ℝ) ≤ (Int.fract ((↑n : ℝ) / (↑p : ℝ)) - (1 / 2 : ℝ)) * Real.log (↑p : ℝ), withh20r : (20 : ℝ) * (↑p : ℝ) < (11 : ℝ) * (↑k : ℝ).Lean, line 59
have h20r : (20 : ℝ) * p < 11 * k := by exact_mod_cast h20
hterm.hfrachave(9 / 11 : ℝ) ≤ Int.fract ((↑n : ℝ) / (↑p : ℝ))Leaves
(7 / 22 : ℝ) * Real.log (↑p : ℝ) ≤ (Int.fract ((↑n : ℝ) / (↑p : ℝ)) - (1 / 2 : ℝ)) * Real.log (↑p : ℝ), withhfrac : (9 / 11 : ℝ) ≤ Int.fract ((↑n : ℝ) / (↑p : ℝ)).Uses library
Int.fractInt.fract athe fractional part ofa, isaminus its floor. ,le_div_iff₀Seele_div_iff₀'for a version with multiplication on the other side. .Lean, lines 60–62
have hfrac : (9 / 11 : ℝ) ≤ Int.fract ((n : ℝ) / p) := by rw [hfr, le_div_iff₀ hp0] linarithhterm.hloghave(0 : ℝ) ≤ Real.log (↑p : ℝ)Leaves
(7 / 22 : ℝ) * Real.log (↑p : ℝ) ≤ (Int.fract ((↑n : ℝ) / (↑p : ℝ)) - (1 / 2 : ℝ)) * Real.log (↑p : ℝ), withhlog : (0 : ℝ) ≤ Real.log (↑p : ℝ).Uses library
Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. ,Real.log_natCast_nonneg.Lean, line 63
have hlog : 0 ≤ Real.log p := Real.log_natCast_nonneg p
hsumhave(7 / 22 : ℝ) * ∑ p ∈ S, Real.log (↑p : ℝ) ≤ ∑ p ∈ S, (Int.fract ((↑n : ℝ) / (↑p : ℝ)) - (1 / 2 : ℝ)) * Real.log (↑p : ℝ)Leaves
False, withhsum : (7 / 22 : ℝ) * ∑ p ∈ S, Real.log (↑p : ℝ) ≤ ∑ p ∈ S, (Int.fract ((↑n : ℝ) / (↑p : ℝ)) - (1 / 2 : ℝ)) * Real.log (↑p : ℝ).Uses library
Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. ,Int.fractInt.fract athe fractional part ofa, isaminus its floor. ,Finset.mul_sum,Finset.sum_le_sumIn an ordered additive commutative monoid, if each summandf iof one finite sum is less than or equal to the corresponding summandg iof another finite sum, then∑ i ∈ s, f i ≤ ∑ i ∈ s, g i. .Lean, lines 65–68
have hsum : (7 / 22 : ℝ) * ∑ p ∈ S, Real.log p ≤ ∑ p ∈ S, (Int.fract ((n : ℝ) / p) - 1 / 2) * Real.log p := by rw [Finset.mul_sum] exact Finset.sum_le_sum htermhc'have(↑k : ℝ) / (100 : ℝ) ≤ ∑ p ∈ Finset.range k with Nat.Prime p ∧ k < (2 : ℕ) * p ∧ (20 : ℕ) * p < (11 : ℕ) * k, Real.log (↑p : ℝ)Leaves
False, withhc' : (↑k : ℝ) / (100 : ℝ) ≤ ∑ p ∈ Finset.range k with Nat.Prime p ∧ k < (2 : ℕ) * p ∧ (20 : ℕ) * p < (11 : ℕ) * k, Real.log (↑p : ℝ).Lean, line 69
have hc' := hc k hk3
hs'have|∑ p ∈ Finset.range k with Nat.Prime p ∧ k < (2 : ℕ) * p ∧ (20 : ℕ) * p < (11 : ℕ) * k, (Int.fract ((↑n : ℝ) / (↑p : ℝ)) - (1 / 2 : ℝ)) * Real.log (↑p : ℝ)| ≤ (1 / 1000 : ℝ) * (↑k : ℝ)Leaves
False, withhs' : |∑ p ∈ Finset.range k with Nat.Prime p ∧ k < (2 : ℕ) * p ∧ (20 : ℕ) * p < (11 : ℕ) * k, (Int.fract ((↑n : ℝ) / (↑p : ℝ)) - (1 / 2 : ℝ)) * Real.log (↑p : ℝ)| ≤ (1 / 1000 : ℝ) * (↑k : ℝ).Lean, line 70
have hs' := hs n k hk4 hlow hup
habshave∑ p ∈ S, (Int.fract ((↑n : ℝ) / (↑p : ℝ)) - (1 / 2 : ℝ)) * Real.log (↑p : ℝ) ≤ |∑ p ∈ S, (Int.fract ((↑n : ℝ) / (↑p : ℝ)) - (1 / 2 : ℝ)) * Real.log (↑p : ℝ)|Leaves
False, withhabs : ∑ p ∈ S, (Int.fract ((↑n : ℝ) / (↑p : ℝ)) - (1 / 2 : ℝ)) * Real.log (↑p : ℝ) ≤ |∑ p ∈ S, (Int.fract ((↑n : ℝ) / (↑p : ℝ)) - (1 / 2 : ℝ)) * Real.log (↑p : ℝ)|.Uses library
le_abs_self,Int.fractInt.fract athe fractional part ofa, isaminus its floor. ,Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. .Lean, line 71
have habs := le_abs_self (∑ p ∈ S, (Int.fract ((n : ℝ) / p) - 1 / 2) * Real.log p)
hkposhave(0 : ℝ) < (↑k : ℝ)Leaves
False, withhkpos : (0 : ℝ) < (↑k : ℝ).Lean, line 72
have hkpos : (0 : ℝ) < k := by exact_mod_cast (show 0 < k by omega)
closetermFalseCloses the goal.
import Mathlib
import Nodes.«erdos-1094--h3--h3».Context
open scoped Nat
/-! Hole `h_gr` of a merged partial proof, as a node (D-12 #5, D-29).
Statement generated by the gate from the assembly; immutable (D-3). -/
theorem erdos_1094__h3__h3 : ∀ (C : ℕ),
∃ (K₂ : ℕ),
∀ (n k : ℕ),
K₂ < k →
k * k ≤ C * (n * Nat.log (2 : ℕ) k) →
n < k * k → ∃ (p : ℕ), Nat.Prime p ∧ k < (2 : ℕ) * p ∧ (20 : ℕ) * p < (11 : ℕ) * k ∧ n % p < k % p := by
-- annex: 88f9e9a7ddffdc9d2a479880cf6eaa066f94ea7f17936fe431b479452d6c05bd
-- Second level of Granville–Ramaré, Mathematika 43 (1996) 73–107, Theorem 8, §5e
-- (preprint pp. 24–25), the analytic step. Suppose no prime p in (k/2, 11k/20) has a
-- last-digit carry; then {n/p} ≥ k/p − 1 > 9/11 for each such p (GR read the same
-- no-carry condition as {m/p} < 1/5 with m = n − k), so Σ ({n/p} − 1/2) log p is
-- ≥ (7/22) Σ log p, which h_cheb makes ≫ k and h_sander makes o(k).
-- h_cheb: the "≫ k" of p. 25, used and not proved by GR: Σ_{k/2<p<11k/20} log p ≫ k,
-- the prime number theorem on (x, 1.1x) (θ(1.1x) − θ(x) ~ x/10 with x = k/2).
have h_cheb : ∃ K₃ : ℕ, ∀ k : ℕ, K₃ < k →
(k : ℝ) / 100 ≤ ∑ p ∈ (Finset.range k).filter (fun p => p.Prime ∧ k < 2 * p ∧ 20 * p < 11 * k),
Real.log p := by
sorry
-- h_sander: GR's (5.1) (p. 18; the J = 1 case of their Lemma 5.1, taken from Sander [Sa2],
-- J. reine angew. Math. 430) on the interval (k/2, 11k/20), with its error terms o(k) on
-- this node's range (k² ≪ n log k, n < k²). Applied at x = n rather than GR's n − k: (5.1)
-- is uniform in x. Written with {t} − 1/2 in place of GR's ψ(t) (ψ is 0 at integers); the two
-- differ only at primes p | n, at most two in (k/2, k] when n < k² and k > 8, so O(log k).
have h_sander : ∀ (C : ℕ) (ε : ℝ), 0 < ε → ∃ K₄ : ℕ, ∀ n k : ℕ, K₄ < k →
k * k ≤ C * (n * Nat.log 2 k) → n < k * k →
|∑ p ∈ (Finset.range k).filter (fun p => p.Prime ∧ k < 2 * p ∧ 20 * p < 11 * k),
(Int.fract ((n : ℝ) / p) - 1 / 2) * Real.log p| ≤ ε * k := by
sorry
intro C
obtain ⟨K₃, hc⟩ := h_cheb
obtain ⟨K₄, hs⟩ := h_sander C (1 / 1000) (by norm_num)
refine ⟨max K₃ K₄, fun n k hk hlow hup => ?_⟩
have hk3 : K₃ < k := lt_of_le_of_lt (le_max_left _ _) hk
have hk4 : K₄ < k := lt_of_le_of_lt (le_max_right _ _) hk
by_contra hno
push_neg at hno
set S := (Finset.range k).filter (fun p => p.Prime ∧ k < 2 * p ∧ 20 * p < 11 * k) with hS
have hterm : ∀ p ∈ S, (7 / 22 : ℝ) * Real.log p ≤ (Int.fract ((n : ℝ) / p) - 1 / 2) * Real.log p := by
intro p hp
rw [hS, Finset.mem_filter] at hp
obtain ⟨-, hpr, h2p, h20⟩ := hp
have hmod := hno p hpr h2p h20
have hpk : p ≤ k := by omega
have hkp : k % p = k - p := by
rw [Nat.mod_eq_sub_mod hpk, Nat.mod_eq_of_lt (by omega)]
have hp0 : (0 : ℝ) < p := by exact_mod_cast hpr.pos
have hfr : Int.fract ((n : ℝ) / p) = ((n % p : ℕ) : ℝ) / p := Int.fract_div_natCast_eq_div_natCast_mod
have hge : ((k - p : ℕ) : ℝ) ≤ ((n % p : ℕ) : ℝ) := by exact_mod_cast (hkp ▸ hmod)
have hsub : ((k - p : ℕ) : ℝ) = (k : ℝ) - p := by
rw [Nat.cast_sub hpk]
have h20r : (20 : ℝ) * p < 11 * k := by exact_mod_cast h20
have hfrac : (9 / 11 : ℝ) ≤ Int.fract ((n : ℝ) / p) := by
rw [hfr, le_div_iff₀ hp0]
linarith
have hlog : 0 ≤ Real.log p := Real.log_natCast_nonneg p
nlinarith
have hsum : (7 / 22 : ℝ) * ∑ p ∈ S, Real.log p ≤
∑ p ∈ S, (Int.fract ((n : ℝ) / p) - 1 / 2) * Real.log p := by
rw [Finset.mul_sum]
exact Finset.sum_le_sum hterm
have hc' := hc k hk3
have hs' := hs n k hk4 hlow hup
have habs := le_abs_self (∑ p ∈ S, (Int.fract ((n : ℝ) / p) - 1 / 2) * Real.log p)
have hkpos : (0 : ℝ) < k := by exact_mod_cast (show 0 < k by omega)
linarithAnnexes (1), in full
Untrusted contributor text — an annex (D-31): an informal argument, not a proof.
Untrusted: annex (D-31), by t1015b-g, drafted with Claude Opus 5.5 (claude-opus-5-5) as agents t1015b-g and t1015b-h, reading the Granville–Ramaré preprint page images, 2026-10-15T13:21:38Z, licence CC-BY-4.0. Rendered from targets/erdos-1094/nodes/erdos-1094--h3--h3/annex/88f9e9a7ddffdc9d2a479880cf6eaa066f94ea7f17936fe431b479452d6c05bd.md.
The analytic step of Granville–Ramaré's Theorem 8 (§5e, pp. 24–25 of their preprint), split along its own seams: a prime-sum lower bound and the equidistribution bound (5.1).
Source. A. Granville and O. Ramaré, Mathematika 43 (1996) 73–107; page numbers are the authors' preprint's. Read by t1015b-g and t1015b-h on 2026-10-15. This node is the hole h_gr of the skeleton on erdos-1094--h3 (annex there).
The statement. For every C there is K such that for k > K, k² ≤ C·n·log₂k and n < k², some prime p with k/2 < p < 11k/20 has n mod p < k mod p.
GR's argument (p. 25), and the form used here. Suppose no such p. For such p, k mod p = k − p, so n mod p ≥ k − p, i.e. the fractional part {n/p} ≥ k/p − 1 > 20/11 − 1 = 9/11. (GR work with m = n − k and get {m/p} < 1/5 for every such p; the condition is the same no-carry condition read from the other summand, and using n avoids natural subtraction. This is our deviation in form, not in substance.) Hence each term ({n/p} − 1/2) log p is at least (7/22) log p, and
Σ_{k/2<p<11k/20} ({n/p} − 1/2) log p ≥ (7/22) Σ_{k/2<p<11k/20} log p.
h_cheb(used, not proved, by GR: the "≫ k" on p. 25): Σ_{k/2<p<11k/20} log p ≥ k/100 for large k. This is the prime number theorem for the interval (x, 1.1x): θ(1.1x) − θ(x) ~ 0.1x with x = k/2, so the sum is ~ k/20. Bertrand's postulate is too weak and Chebyshev's elementary constants do not reach a ratio of 1.1.h_sander((5.1), p. 18, the J = 1 case of Lemma 5.1, which GR take from Sander [Sa2], J. reine angew. Math. 430): for every C and ε > 0, for large k on the range above, |Σ_{k/2<p<11k/20} ({n/p} − 1/2) log p| ≤ εk. From (5.1) with x = n and y = k/2, 11k/20: the error terms are y^{3/2+δ}x^{−1/2}log⁵x ≪ k^{1/2+2δ} (as n ≫ k²/log k) and y^{1−c(log y/log x)²}log⁵x ≪ k^{1−c/4+o(1)} (as n < k²), both o(k). GR's ψ is 0 at integers and {t} − 1/2 elsewhere; the two differ only at primes p | n, of which there are at most two in (k/2, k] when n < k² and k > 8, so the difference is O(log k). That is our second deviation in form.
Assembly (proved in Lean). With ε = 1/1000: (7/22)(k/100) > k/1000, a contradiction. So the assembly is elementary; both holes are analytic number theory (h_cheb: PNT in short intervals; h_sander: exponential sums over primes, Vaughan's identity).
How to read this page
No explainer yet. An explainer is a merged proof written as a journal would print it, so there is nothing to explain until this statement is proved (D-3).