{
  "id": "3380",
  "ident": "NS.03380",
  "slug": "erdos-841",
  "title": "Erdős Problem 841",
  "status": "solved",
  "statement_status": "reviewed",
  "statement_md": "Let $t_n$ be minimal such that $\\{n+1,\\ldots,n+t_n\\}$ contains a subset whose product with $n$ is\na square number (and let $t_n=0$ if $n$ is itself square). Estimate $t_n$.\n\nA problem of Erdős, Graham, and Selfridge. For example, $t_6=6$ since $6\\cdot 8\\cdot 12=24^2$. It\nis trivial that $t_n\\geq P(n)$, where $P(n)$ is the largest prime divisor of $n$.\n\nBui, Pratt, and Zaharescu [BPZ24] proved that the distribution of $t_n$ continues to follow\n$P(n)$, in that for any fixed $c\\in (0,1]$\n$$\\lim_{x\\to \\infty}\\frac{\\lvert \\{ n\\leq x : t_n\\leq n^c\\}\\rvert}{x}\n  = \\lim_{x\\to \\infty}\\frac{\\lvert \\{ n\\leq x : P(n)\\leq n^c\\}\\rvert}{x}.$$\nThe statement below is that the difference of the two counting functions is $o(x)$.\n\nThis was formalized in Lean by Codex.",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [
    "formal_proof"
  ],
  "collection": "erdos",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "Erdos841.erdos_841",
  "statement_lean": "theorem erdos_841 (c : ℝ) (hc : c ∈ Set.Ioc 0 1) :\n    Tendsto (fun x : ℕ ↦\n      ((((Finset.Icc 1 x).filter fun n : ℕ ↦ (t n : ℝ) ≤ (n : ℝ) ^ c).card : ℝ) -\n        ((Finset.Icc 1 x).filter fun n : ℕ ↦ (n.maxPrimeFac : ℝ) ≤ (n : ℝ) ^ c).card) / x)\n      atTop (𝓝 0)",
  "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 841\n\n*References:*\n- [erdosproblems.com/841](https://www.erdosproblems.com/841)\n- [ErSe92] Erdős, Paul and Selfridge, J. L., Problems and Solutions: Solutions: 6655. Amer. Math.\n  Monthly (1992), 791--794.\n- [BPZ24] Bui, Hung M. and Pratt, Kyle and Zaharescu, Alexandru, A problem of\n  Erdős-Graham-Granville-Selfridge on integral points on hyperelliptic curves. Math. Proc.\n  Cambridge Philos. Soc. (2024), 309--323.\n- [Gu04] Guy, Richard K., Unsolved problems in number theory. (2004), xviii+437.\n-/\n\n@[expose] public section\n\nopen Filter Real Topology\n\nnamespace Erdos841\n\n/-- `t n` is the least `T` such that `{n + 1, …, n + T}` contains a subset whose product with `n`\nis a square; `t n = 0` if and only if `n` is itself a square. -/\nnoncomputable def t (n : ℕ) : ℕ :=\n  sInf {T | ∃ J ⊆ Finset.Icc 1 T, IsSquare (n * ∏ j ∈ J, (n + j))}\n\nopen scoped Classical in\nset_option linter.style.formal_proof_palomar false in\n/--\nLet $t_n$ be minimal such that $\\{n+1,\\ldots,n+t_n\\}$ contains a subset whose product with $n$ is\na square number (and let $t_n=0$ if $n$ is itself square). Estimate $t_n$.\n\nA problem of Erdős, Graham, and Selfridge. For example, $t_6=6$ since $6\\cdot 8\\cdot 12=24^2$. It\nis trivial that $t_n\\geq P(n)$, where $P(n)$ is the largest prime divisor of $n$.\n\nBui, Pratt, and Zaharescu [BPZ24] proved that the distribution of $t_n$ continues to follow\n$P(n)$, in that for any fixed $c\\in (0,1]$\n$$\\lim_{x\\to \\infty}\\frac{\\lvert \\{ n\\leq x : t_n\\leq n^c\\}\\rvert}{x}\n  = \\lim_{x\\to \\infty}\\frac{\\lvert \\{ n\\leq x : P(n)\\leq n^c\\}\\rvert}{x}.$$\nThe statement below is that the difference of the two counting functions is $o(x)$.\n\nThis was formalized in Lean by Codex.\n-/\n@[category research solved, AMS 11, formal_proof using lean4 at \"https://github.com/plby/lean-proofs/blob/8822f7ddef30fadbd92e1c6ab4ed897af356af5e/src/latest/ErdosProblems/Erdos841/Core.lean#L16920\"]\ntheorem erdos_841 (c : ℝ) (hc : c ∈ Set.Ioc 0 1) :\n    Tendsto (fun x : ℕ ↦\n      ((((Finset.Icc 1 x).filter fun n : ℕ ↦ (t n : ℝ) ≤ (n : ℝ) ^ c).card : ℝ) -\n        ((Finset.Icc 1 x).filter fun n : ℕ ↦ (n.maxPrimeFac : ℝ) ≤ (n : ℝ) ^ c).card) / x)\n      atTop (𝓝 0) := by\n  sorry\n\nset_option linter.style.formal_proof_palomar false in\n/--\nSelfridge proved that $t_n=P(n)$ if $P(n)>\\sqrt{2n}+1$.\n\nThis was formalized in Lean by Codex.\n-/\n@[category research solved, AMS 11, formal_proof using lean4 at \"https://github.com/plby/lean-proofs/blob/8822f7ddef30fadbd92e1c6ab4ed897af356af5e/src/latest/ErdosProblems/Erdos841/LowerBound.lean#L3183\"]\ntheorem erdos_841.variants.selfridge_large_prime (n : ℕ) (hn : 1 < n)\n    (h : √(2 * n) + 1 < (n.maxPrimeFac : ℝ)) : t n = n.maxPrimeFac := by\n  sorry\n\nset_option linter.style.formal_proof_palomar false in\n/--\nSelfridge proved that $t_n \\ll n^{1/2}$ if $P(n)\\leq\\sqrt{2n}+1$.\n\nThis was formalized in Lean by Codex.\n-/\n@[category research solved, AMS 11, formal_proof using lean4 at \"https://github.com/plby/lean-proofs/blob/8822f7ddef30fadbd92e1c6ab4ed897af356af5e/src/latest/ErdosProblems/Erdos841/Core.lean#L1373\"]\ntheorem erdos_841.variants.selfridge_sqrt :\n    ∃ C : ℝ, ∀ n : ℕ, (n.maxPrimeFac : ℝ) ≤ √(2 * n) + 1 → (t n : ℝ) ≤ C * √n := by\n  sorry\n\nopen scoped Classical in\nset_option linter.style.formal_proof_palomar false in\n/--\nBui, Pratt, and Zaharescu [BPZ24] proved that for at least $x^{1-o(1)}$ many $n\\leq x$ we have\n$$t_n \\leq \\exp(O(\\sqrt{\\log n\\log\\log n})).$$\n\nThis was formalized in Lean by Codex.\n-/\n@[category research solved, AMS 11, formal_proof using lean4 at \"https://github.com/plby/lean-proofs/blob/8822f7ddef30fadbd92e1c6ab4ed897af356af5e/src/latest/ErdosProblems/Erdos841/Core.lean#L16105\"]\ntheorem erdos_841.variants.many_small_values : ∃ K : ℝ,\n    Tendsto (fun x : ℕ ↦\n      log (((Finset.Icc 1 x).filter fun n ↦\n        (t n : ℝ) ≤ exp (K * √(log n * log (log n)))).card : ℝ) / log x) atTop (𝓝 1) := by\n  sorry\n\nset_option linter.style.formal_proof_palomar false in\n/--\nBui, Pratt, and Zaharescu [BPZ24] proved that for all non-square $n$\n$$t_n \\gg (\\log\\log n)^{6/5}(\\log\\log\\log n)^{-1/5}.$$\n\nThis was formalized in Lean by Codex.\n-/\n@[category research solved, AMS 11, formal_proof using lean4 at \"https://github.com/plby/lean-proofs/blob/8822f7ddef30fadbd92e1c6ab4ed897af356af5e/src/latest/ErdosProblems/Erdos841/LowerBound.lean#L3166\"]\ntheorem erdos_841.variants.lower_bound : ∃ C : ℝ, 0 < C ∧\n    ∀ᶠ n : ℕ in atTop, ¬ IsSquare n →\n      C * (log (log n) ^ ((6 : ℝ) / 5) * log (log (log n)) ^ (-(1 : ℝ) / 5)) ≤ t n := by\n  sorry\n\nend Erdos841\n",
  "statement_hash": "d7b1489ed2d7c9280b6ae6059096df2b1d21f7dff72760971a4f53195896221b",
  "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."
}