{
  "id": "3405",
  "ident": "NS.03405",
  "slug": "erdos-854",
  "title": "Erdős Problem 854",
  "status": "open",
  "statement_status": "reviewed",
  "statement_md": "Let $n_k$ denote the $k$th primorial, i.e. the product of the first $k$ primes.\n\nIf $1=a_1<a_2<\\cdots <a_{\\phi(n_k)}=n_k-1$ is the sequence of integers coprime to $n_k$, then\nestimate the smallest even integer not of the form $a_{i+1}-a_i$. Are there\n$$\\gg \\max_i (a_{i+1}-a_i)$$\nmany even integers of the form $a_{j+1}-a_j$?\n\nThis is the first part. A problem of Erdős [Er85c, p. 80], who writes \"integer\" instead of \"even\ninteger\"; all differences $a_{i+1}-a_i$ are even, so only even integers are meaningful. Here\n\"estimate\" is read as $\\Theta$. Erdős first thought that for large $k$ every even $t \\leq\n\\max_i(a_{i+1}-a_i)$ is a gap, but [Ob1] reports computations of Lacampagne and Selfridge showing\nthis fails for $n_6 = 30030$ (OEIS A389839 and A048670 give $20$ and $22$).",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [
    "question"
  ],
  "collection": "erdos",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "Erdos854.erdos_854.parts.i",
  "statement_lean": "theorem erdos_854.parts.i :\n    (fun k ↦ (minEvenNonGap k : ℝ)) =Θ[atTop] erdos_854.parts.i.answer",
  "challenge_source": "/-\nCopyright 2026 The Formal Conjectures Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    https://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n-/\nmodule\n\npublic import FormalConjecturesUtil\npublic import FormalConjectures.ErdosProblems.«235»\n\n/-!\n# Erdős Problem 854\n\n*References:*\n- [erdosproblems.com/854](https://www.erdosproblems.com/854)\n- [Er85c] Erdős, P., *On some of my problems in number theory I would most like to see solved*.\n  Number theory (Ootacamund, 1984), Lecture Notes in Math. 1122 (1985), 74-84.\n  [PDF](https://www.renyi.hu/~p_erdos/1985-17.pdf)\n- [Ob1] Erdős, P., *Oberwolfach Mathematical Problems*, Volume 1. Mathematisches\n  Forschungsinstitut Oberwolfach.\n- [OEIS A389839](https://oeis.org/A389839): smallest even number which cannot be written as the\n  difference of two consecutive numbers which are relatively prime to the $n$th primorial. It\n  agrees with `minEvenNonGap k` for $k\\geq 3$.\n- [OEIS A048670](https://oeis.org/A048670): Jacobsthal's function of the product of the first $n$\n  primes, which is the largest gap.\n-/\n\n@[expose] public section\n\nopen Filter Asymptotics\n\nnamespace Erdos854\n\n/-- The $k$th primorial $n_k = p_1 \\cdots p_k$, the product of the first $k$ primes\n(`Nat.nth Nat.Prime i` is the $(i+1)$st prime, counting from $i = 0$). In particular $n_0 = 1$. -/\nnoncomputable def kthPrimorial (k : ℕ) : ℕ :=\n  ∏ i ∈ Finset.range k, Nat.nth Nat.Prime i\n\n/-- `gapSet m` is the set of values of $a_{i+1} - a_i$, where $a_1 < a_2 < \\cdots$ are the\nintegers in $[1, m)$ coprime to $m$ (for $m > 1$). It is the set of entries of `Erdos235.gaps m`,\nthe differences of consecutive entries of the sorted list of integers below `m` coprime to `m`. -/\ndef gapSet (m : ℕ) : Finset ℕ :=\n  (Erdos235.gaps m).toFinset\n\n/-- `maxGap m` is $\\max_i (a_{i+1} - a_i)$ for the integers in $[1, m)$ coprime to `m`, and `0`\nif there are no gaps. For $m = n_k$ with $k\\geq 2$ this is the Jacobsthal function of $m$. -/\ndef maxGap (m : ℕ) : ℕ :=\n  (gapSet m).sup id\n\n/-- $f(k)$: the smallest positive even integer that is not of the form $a_{i+1} - a_i$ for the\nintegers $a_1 < a_2 < \\cdots$ in $[1, n_k)$ coprime to $n_k$. The condition `0 < t` is needed\nsince $0$ is not a gap. For $k \\geq 1$ the set contains $n_k$ itself (even, and larger than every\ngap), so `sInf` is a true minimum. -/\nnoncomputable def minEvenNonGap (k : ℕ) : ℕ :=\n  sInf {t : ℕ | 0 < t ∧ Even t ∧ t ∉ gapSet (kthPrimorial k)}\n\n/-- The third primorial is $2 \\cdot 3 \\cdot 5 = 30$. -/\n@[category test, AMS 11]\ntheorem kthPrimorial_three : kthPrimorial 3 = 30 := by\n  simp [kthPrimorial, Finset.prod_range_succ, Nat.nth_prime_zero_eq_two,\n    Nat.nth_prime_one_eq_three, Nat.nth_prime_two_eq_five]\n\ndef erdos_854.parts.i.answer : ℕ → ℝ := sorry\n\n/--\nLet $n_k$ denote the $k$th primorial, i.e. the product of the first $k$ primes.\n\nIf $1=a_1<a_2<\\cdots <a_{\\phi(n_k)}=n_k-1$ is the sequence of integers coprime to $n_k$, then\nestimate the smallest even integer not of the form $a_{i+1}-a_i$. Are there\n$$\\gg \\max_i (a_{i+1}-a_i)$$\nmany even integers of the form $a_{j+1}-a_j$?\n\nThis is the first part. A problem of Erdős [Er85c, p. 80], who writes \"integer\" instead of \"even\ninteger\"; all differences $a_{i+1}-a_i$ are even, so only even integers are meaningful. Here\n\"estimate\" is read as $\\Theta$. Erdős first thought that for large $k$ every even $t \\leq\n\\max_i(a_{i+1}-a_i)$ is a gap, but [Ob1] reports computations of Lacampagne and Selfridge showing\nthis fails for $n_6 = 30030$ (OEIS A389839 and A048670 give $20$ and $22$).\n-/\n@[category research open, question value, AMS 11]\ntheorem erdos_854.parts.i :\n    (fun k ↦ (minEvenNonGap k : ℝ)) =Θ[atTop] erdos_854.parts.i.answer := by\n  sorry\n\n/--\nLet $n_k$ denote the $k$th primorial, i.e. the product of the first $k$ primes.\n\nIf $1=a_1<a_2<\\cdots <a_{\\phi(n_k)}=n_k-1$ is the sequence of integers coprime to $n_k$, then\nestimate the smallest even integer not of the form $a_{i+1}-a_i$. Are there\n$$\\gg \\max_i (a_{i+1}-a_i)$$\nmany even integers of the form $a_{j+1}-a_j$?\n\nThis is the second part. We read it as: there is an absolute constant $c > 0$ such that, for all\nlarge $k$, the number of distinct gap values is at least $c$ times the largest gap.\n-/\n@[category research open, question, AMS 11]\ntheorem erdos_854.parts.ii :\n    ∃ c > (0 : ℝ), ∀ᶠ k : ℕ in atTop,\n      c * (maxGap (kthPrimorial k) : ℝ) ≤ ((gapSet (kthPrimorial k)).card : ℝ) := by\n  sorry\n\nend Erdos854\n",
  "statement_hash": "67be9458c1991774e6d340ac24cfe8396aba953272b3dc1a559b904d19561f53",
  "toolchain": "leanprover/lean4:v4.33.1",
  "upstream_commit": "f9b3868d5ca994a7bf95039bcec05338c0c21e2f",
  "workspace": "formal-conjectures",
  "field": "math",
  "formalization": "formal",
  "verification": "lean-kernel",
  "license": "Apache-2.0",
  "attribution": "google-deepmind/formal-conjectures contributors",
  "metric_name": null,
  "metric_direction": null,
  "critiques": [],
  "public_partial_proofs": [],
  "research_threads": [],
  "instructions": "Read research_threads first: other people's public repositories and what they already tried. Write Solution.lean starting from challenge_source. Keep every definition identical, prove decl_name with exactly the same type, no sorry in its dependency closure, no new axioms, no native_decide, no metaprogramming. Submit with POST /api/v1/submissions."
}