{
  "id": "3234",
  "ident": "NS.03234",
  "slug": "erdos-796",
  "title": "Erdős Problem 796",
  "status": "solved",
  "statement_status": "reviewed",
  "statement_md": "Let $k\\geq 2$ and let $g_k(n)$ be the largest possible size of\n$A\\subseteq \\{1,\\ldots,n\\}$ such that every $m$ has $<k$ solutions to\n$m=a_1a_2$ with $a_1<a_2\\in A$. Is it true that\n$$g_3(n)=\\frac{\\log\\log n}{\\log n}n+(c+o(1))\\frac{n}{\\log n}$$\nfor some constant $c$?\n\nThe answer is yes: the rescaled error `normalizedError` converges.",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [
    "question",
    "formal_proof"
  ],
  "collection": "erdos",
  "source_url": "https://www.erdosproblems.com/796",
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "Erdos796.erdos_796",
  "statement_lean": "theorem erdos_796 :\n    ∃ c : ℝ, Tendsto normalizedError 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-/\nmodule\n\npublic import FormalConjecturesUtil\n\n/-!\n# Erdős Problem 796\n\n*Reference:* [erdosproblems.com/796](https://www.erdosproblems.com/796)\n-/\n\n@[expose] public section\n\nnamespace Erdos796\n\nopen Filter\nopen scoped Topology\n\n/-- The number of unordered representations `m = a₁ * a₂` by two distinct\nelements `a₁ < a₂` of `A`. -/\ndef repCount (A : Finset ℕ) (m : ℕ) : ℕ :=\n  ((A ×ˢ A).filter fun a => a.1 < a.2 ∧ a.1 * a.2 = m).card\n\n/-- `A` has at most `k - 1` representations of every `m` (fewer than `k`). -/\ndef HasRepBound (k : ℕ) (A : Finset ℕ) : Prop := ∀ m : ℕ, repCount A m < k\n\nopen scoped Classical in\n/-- `g k n = g_k(n)` is the largest size of a subset `A ⊆ {1, …, n}` in which\nevery `m` has fewer than `k` representations `m = a₁ a₂` with `a₁ < a₂ ∈ A`. -/\nnoncomputable def g (k n : ℕ) : ℕ :=\n  ((Finset.Icc 1 n).powerset.filter (HasRepBound k)).sup Finset.card\n\n/-- The proposed second-order rescaling of `g_3(n)`:\n`(g_3(n) - (log log n / log n) · n) / (n / log n)`, whose limit is the constant\n`c` in the problem. -/\nnoncomputable def normalizedError (n : ℕ) : ℝ :=\n  ((g 3 n : ℝ) - (n : ℝ) * Real.log (Real.log n) / Real.log n) / ((n : ℝ) / Real.log n)\n\nset_option linter.style.formal_proof_palomar false in\n/--\nLet $k\\geq 2$ and let $g_k(n)$ be the largest possible size of\n$A\\subseteq \\{1,\\ldots,n\\}$ such that every $m$ has $<k$ solutions to\n$m=a_1a_2$ with $a_1<a_2\\in A$. Is it true that\n$$g_3(n)=\\frac{\\log\\log n}{\\log n}n+(c+o(1))\\frac{n}{\\log n}$$\nfor some constant $c$?\n\nThe answer is yes: the rescaled error `normalizedError` converges.\n-/\n@[category research solved, question, AMS 11, formal_proof using lean4 at \"https://github.com/williamjblair/lean-proofs/blob/4f915a323443bfb1709a6805a013812016dca88a/starfleet/erdos-796/Research/CanonicalTail.lean\"]\ntheorem erdos_796 :\n    ∃ c : ℝ, Tendsto normalizedError atTop (𝓝 c) := by\n  sorry\n\nend Erdos796\n",
  "statement_hash": "190043b14af42eb9f0c74409522c74126ddb769b545a332111b6f5707594dbf9",
  "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."
}