{
  "id": "353",
  "ident": "NS.00353",
  "slug": "erdos-1005",
  "title": "Erdős Problem 1005",
  "status": "solved",
  "statement_status": "reviewed",
  "statement_md": "Let $\\frac{a_1}{b_1}, \\frac{a_2}{b_2}, \\ldots$ be the Farey fractions of order $n \\geq 4$. Let\n$f(n)$ be the largest integer such that if $1 \\leq k < l \\leq k + f(n)$ then $\\frac{a_k}{b_k}$ and\n$\\frac{a_l}{b_l}$ are similarly ordered, in other words $(a_k - a_l)(b_k - b_l) \\geq 0$. Estimate\n$f(n)$: in particular, is there a constant $c > 0$ such that $f(n) = (c + o(1)) n$ for all\nlarge $n$?\n\nMayer [Ma42] proved that $f(n) \\to \\infty$ and Erdős [Er43] that $f(n) \\gg n$. Van Doorn [vD25b]\nproved $(1/12 - o(1)) n \\le f(n) \\le n / 4 + O(1)$ and conjectured that $f(n) = (1/4 + o(1)) n$,\nwhich was proved by Cipollini and GPT-5.5; see `erdos_1005.variants.constant`.",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [
    "question"
  ],
  "collection": "erdos",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "Erdos1005.erdos_1005",
  "statement_lean": "theorem erdos_1005 :\n    ∃ c : ℝ, 0 < c ∧ Tendsto (fun n : ℕ => (f n : ℝ) / n) atTop (𝓝 c)",
  "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-/\n\nmodule\n\npublic import FormalConjecturesUtil\n\n/-!\n# Erdős Problem 1005\n\n*References:*\n- [erdosproblems.com/1005](https://www.erdosproblems.com/1005)\n- [Ma42] Mayer, A. E., *A mean value theorem concerning Farey series*. Quart. J. Math. Oxford\n  Ser. (1942), 48-57.\n- [Er43] Erdős, P., *A note on Farey series*. Quart. J. Math. Oxford Ser. (1943), 82-85.\n- [vD25b] van Doorn, W., *Improved bounds for the Mayer-Erdős phenomenon on similarly ordered Farey\n  fractions*. [arXiv:2509.00121](https://arxiv.org/abs/2509.00121) (2025).\n-/\n\n@[expose] public section\n\nopen Filter\nopen scoped Topology\n\nnamespace Erdos1005\n\n/-- A rational `q` is a Farey fraction of order `n` if it lies in `[0, 1]` and has denominator at\nmost `n`. (Every `q : ℚ` is stored in lowest terms, so `q.den` and `q.num` are the reduced\ndenominator and numerator.) -/\ndef IsFarey (n : ℕ) (q : ℚ) : Prop :=\n  0 ≤ q ∧ q ≤ 1 ∧ q.den ≤ n\n\n/-- The number of Farey fractions of order `n` strictly between `x` and `y`. -/\nnoncomputable def betweenCount (n : ℕ) (x y : ℚ) : ℕ :=\n  {q : ℚ | IsFarey n q ∧ x < q ∧ q < y}.ncard\n\n/-- `f n` is the largest integer such that any two Farey fractions of order `n` whose indices\ndiffer by at most `f n` are similarly ordered: it is the minimum, over all pairs `x < y` of Farey\nfractions of order `n` with `(x.num - y.num) * (x.den - y.den) < 0`, of the number of Farey\nfractions strictly between `x` and `y`. -/\nnoncomputable def f (n : ℕ) : ℕ :=\n  sInf {k | ∃ x y : ℚ, IsFarey n x ∧ IsFarey n y ∧ x < y ∧\n    (x.num - y.num) * ((x.den : ℤ) - y.den) < 0 ∧ betweenCount n x y = k}\n\n/--\nLet $\\frac{a_1}{b_1}, \\frac{a_2}{b_2}, \\ldots$ be the Farey fractions of order $n \\geq 4$. Let\n$f(n)$ be the largest integer such that if $1 \\leq k < l \\leq k + f(n)$ then $\\frac{a_k}{b_k}$ and\n$\\frac{a_l}{b_l}$ are similarly ordered, in other words $(a_k - a_l)(b_k - b_l) \\geq 0$. Estimate\n$f(n)$: in particular, is there a constant $c > 0$ such that $f(n) = (c + o(1)) n$ for all\nlarge $n$?\n\nMayer [Ma42] proved that $f(n) \\to \\infty$ and Erdős [Er43] that $f(n) \\gg n$. Van Doorn [vD25b]\nproved $(1/12 - o(1)) n \\le f(n) \\le n / 4 + O(1)$ and conjectured that $f(n) = (1/4 + o(1)) n$,\nwhich was proved by Cipollini and GPT-5.5; see `erdos_1005.variants.constant`.\n-/\n@[category research solved, question, AMS 11]\ntheorem erdos_1005 :\n    ∃ c : ℝ, 0 < c ∧ Tendsto (fun n : ℕ => (f n : ℝ) / n) atTop (𝓝 c) := by\n  sorry\n\nset_option linter.style.formal_proof_palomar false in\n/-- The constant in Problem 1005 is $c = 1/4$: $f(n) = (1/4 + o(1)) n$ (Cipollini and GPT-5.5;\nformalised by Cipollini, van Doorn and Aristotle). -/\n@[category research solved, AMS 11, formal_proof using lean4 at\n  \"https://github.com/plby/lean-proofs/blob/8822f7ddef30fadbd92e1c6ab4ed897af356af5e/src/latest/ErdosProblems/Erdos1005.lean#L44\"]\ntheorem erdos_1005.variants.constant :\n    Tendsto (fun n : ℕ => (f n : ℝ) / n) atTop (𝓝 (1 / 4)) := by\n  sorry\n\nend Erdos1005\n",
  "statement_hash": "0a8b4ffb0960c2077064974a38e39fb93cfd478479ec29fdef50bcb51b8033b6",
  "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."
}