{
  "id": "995",
  "ident": "NS.00995",
  "slug": "erdos-1205",
  "title": "Erdős Problem 1205",
  "status": "solved",
  "statement_status": "reviewed",
  "statement_md": "Let $F(x)$ be maximal such that there exists, for all $n\\leq x$, a congruence class\n$a_n\\pmod{n}$ such that every $m\\leq x$ satisfies at least $F(x)$ of these congruences.\n\nEstimate $F(x)$.\n\nErdős [Er80, p. 108] describes $F(x)\\to\\infty$ as a simple exercise and asks how fast $F(x)$\ntends to infinity. The estimate $F(x)\\sim\\log x$ comes from the argument given on\nerdosproblems.com/1205 (a pigeonhole upper bound and a probabilistic lower bound), not from a\npaper.",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [
    "question",
    "formal_proof"
  ],
  "collection": "erdos",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "Erdos1205.erdos_1205",
  "statement_lean": "theorem erdos_1205 : (fun x : ℕ ↦ (F x : ℝ)) ~[atTop] erdos_1205.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\n\n/-!\n# Erdős Problem 1205\n\n*References:*\n- [erdosproblems.com/1205](https://www.erdosproblems.com/1205)\n- [Er80] Erdős, Paul, *A survey of problems in combinatorial number theory*. Ann. Discrete Math.\n  (1980), 89-115. [PDF](https://www.renyi.hu/~p_erdos/1980-03.pdf)\n-/\n\n@[expose] public section\n\nopen Filter Asymptotics\n\nnamespace Erdos1205\n\n/-- A choice of one congruence class for each modulus $n\\in\\{1,\\ldots,x\\}$. The index\n`i : Fin x` stands for the modulus $n=i+1$, and `a i : Fin (i + 1)` is the residue $a_n \\bmod n$\nchosen for it. -/\nabbrev Assignment (x : ℕ) := (i : Fin x) → Fin (i.1 + 1)\n\n/-- `Covers a m i` says that the integer $m+1\\in\\{1,\\ldots,x\\}$ satisfies the congruence chosen\nfor the modulus $i+1$, that is, $m+1\\equiv a_{i+1} \\pmod{i+1}$ (see `covers_iff_modEq`). -/\ndef Covers {x : ℕ} (a : Assignment x) (m i : Fin x) : Prop :=\n  (m.1 + 1) % (i.1 + 1) = (a i).1\n\n/-- The number of chosen congruences satisfied by the integer $m+1\\in\\{1,\\ldots,x\\}$. -/\nnoncomputable def coverage {x : ℕ} (a : Assignment x) (m : Fin x) : ℕ :=\n  open scoped Classical in\n  ((Finset.univ : Finset (Fin x)).filter fun i ↦ Covers a m i).card\n\n/-- `IsCovering x k` says that some choice of congruence classes, one for each modulus\n$n\\le x$, makes every integer $m\\in\\{1,\\ldots,x\\}$ satisfy at least `k` of the congruences.\nThe clause `k ≤ x` is automatic for `x ≥ 1`, since an integer satisfies at most `x` of the\ncongruences; it only forces `k = 0` when `x = 0`. -/\ndef IsCovering (x k : ℕ) : Prop :=\n  k ≤ x ∧ ∃ a : Assignment x, ∀ m : Fin x, k ≤ coverage a m\n\n/-- $F(x)$: the largest `k ≤ x` with `IsCovering x k`. Since `IsCovering x 0` always holds,\n`Nat.findGreatest` never returns its default value `0` for lack of a witness. For `x ≥ 1` this\nis the maximum of `k` such that some choice of classes covers every $m\\le x$ at least `k` times,\nand $F(0)=0$. -/\nnoncomputable def F (x : ℕ) : ℕ :=\n  open scoped Classical in\n  Nat.findGreatest (IsCovering x) x\n\n/-- The encoding of `Covers` is the congruence $m+1\\equiv a_{i+1}\\pmod{i+1}$. -/\n@[category API, AMS 11]\ntheorem covers_iff_modEq {x : ℕ} (a : Assignment x) (m i : Fin x) :\n    Covers a m i ↔ (m.1 + 1) ≡ (a i).1 [MOD i.1 + 1] := by\n  unfold Covers Nat.ModEq\n  rw [Nat.mod_eq_of_lt (a i).2]\n\n/-- With no moduli and no integers to cover, $F(0)=0$. -/\n@[category API, AMS 11]\ntheorem F_zero : F 0 = 0 := by\n  classical\n  exact Nat.findGreatest_zero\n\n/-- The answer: $F(x)\\sim\\log x$. -/\nnoncomputable def erdos_1205.answer (x : ℕ) : ℝ := Real.log x\n\nset_option linter.style.formal_proof_palomar false in\n/--\nLet $F(x)$ be maximal such that there exists, for all $n\\leq x$, a congruence class\n$a_n\\pmod{n}$ such that every $m\\leq x$ satisfies at least $F(x)$ of these congruences.\n\nEstimate $F(x)$.\n\nErdős [Er80, p. 108] describes $F(x)\\to\\infty$ as a simple exercise and asks how fast $F(x)$\ntends to infinity. The estimate $F(x)\\sim\\log x$ comes from the argument given on\nerdosproblems.com/1205 (a pigeonhole upper bound and a probabilistic lower bound), not from a\npaper.\n-/\n@[category research solved, question value, AMS 11, formal_proof using lean4 at\n  \"https://github.com/plby/lean-proofs/blob/8822f7ddef30fadbd92e1c6ab4ed897af356af5e/src/latest/ErdosProblems/Erdos1205.lean#L1065\"]\ntheorem erdos_1205 : (fun x : ℕ ↦ (F x : ℝ)) ~[atTop] erdos_1205.answer := by\n  sorry\n\nset_option linter.style.formal_proof_palomar false in\n/--\nThe pigeonhole principle implies $F(x)\\leq \\sum_{n\\leq x}\\frac{1}{n}= \\log x+O(1)$.\n\nWe state the exact pigeonhole bound $F(x)\\leq H_x+1$, where $H_x=\\sum_{n\\leq x}\\frac{1}{n}$ is\nthe $x$-th harmonic number. The $+1$ is needed, since $F(3)\\geq 2>H_3$. By Mathlib's\n`harmonic_le_one_add_log` this gives $F(x)\\leq\\log x+2$.\n-/\n@[category research solved, AMS 11, formal_proof using lean4 at\n  \"https://github.com/plby/lean-proofs/blob/8822f7ddef30fadbd92e1c6ab4ed897af356af5e/src/latest/ErdosProblems/Erdos1205.lean#L235\"]\ntheorem erdos_1205.variants.upper_bound (x : ℕ) : (F x : ℝ) ≤ (harmonic x : ℝ) + 1 := by\n  sorry\n\nend Erdos1205\n",
  "statement_hash": "13d393969e8f8a0083612a0eaba1453a4df04addac23cb9b8025264d533779ee",
  "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."
}