{
  "id": "3144",
  "ident": "NS.03144",
  "slug": "erdos-771",
  "title": "Erdős Problem 771",
  "status": "solved",
  "statement_status": "reviewed",
  "statement_md": "Let $f(n)$ be maximal such that, for every $m\\geq 1$, there exists some\n$S\\subseteq \\{1,\\ldots,n\\}$ with $\\lvert S\\rvert=f(n)$ such that $m\\neq \\sum_{a\\in A}a$ for all\n$A\\subseteq S$.\n\nIs it true that\n$$f(n) = \\left(\\frac{1}{2}+o(1)\\right)\\frac{n}{\\log n}?$$\n\nThe answer is yes: the lower bound is due to Erdős and Graham and the upper bound to Alon and\nFreiman [AlFr88].",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [
    "question"
  ],
  "collection": "erdos",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "Erdos771.erdos_771",
  "statement_lean": "theorem erdos_771 :\n    (fun n : ℕ ↦ (f n : ℝ)) ~[atTop] fun n : ℕ ↦ (n : ℝ) / (2 * Real.log n)",
  "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 771\n\n*References:*\n- [erdosproblems.com/771](https://www.erdosproblems.com/771)\n- [Er89] Erdős, P., *Some problems and results on combinatorial number theory*. Graph theory and\n  its applications: East and West (Jinan, 1986), Ann. New York Acad. Sci. 576 (1989), 132-145.\n- [AlFr88] Alon, N. and Freiman, G., *On sums of subsets of a set of integers*. Combinatorica 8\n  (1988), 297-306.\n-/\n\n@[expose] public section\n\nopen Filter Asymptotics\n\nnamespace Erdos771\n\n/-- `IsAdmissible n k` says that for every $m \\geq 1$ there is a $k$-element\n$S \\subseteq \\{1,\\ldots,n\\}$ such that no subset of $S$ sums to $m$. -/\ndef IsAdmissible (n k : ℕ) : Prop :=\n  ∀ m : ℕ, 1 ≤ m → ∃ S ⊆ Finset.Icc 1 n, S.card = k ∧ ∀ A ⊆ S, (∑ a ∈ A, a) ≠ m\n\n/-- $f(n)$: the largest $k$ such that for every $m \\geq 1$ there is a $k$-element\n$S \\subseteq \\{1,\\ldots,n\\}$ with $m \\neq \\sum_{a \\in A} a$ for all $A \\subseteq S$. The set of\nsuch $k$ contains $0$ and is bounded by $n$, so `sSup` is its maximum. -/\nnoncomputable def f (n : ℕ) : ℕ :=\n  sSup {k : ℕ | IsAdmissible n k}\n\n/-- $k = 0$ is always admissible. -/\n@[category API, AMS 11]\ntheorem isAdmissible_zero (n : ℕ) : IsAdmissible n 0 := fun m hm =>\n  ⟨∅, Finset.empty_subset _, Finset.card_empty, fun A hA => by\n    rw [Finset.subset_empty.1 hA, Finset.sum_empty]\n    omega⟩\n\n/-- An admissible $k$ is at most $n$. -/\n@[category API, AMS 11]\ntheorem IsAdmissible.le {n k : ℕ} (h : IsAdmissible n k) : k ≤ n := by\n  obtain ⟨S, hS, rfl, -⟩ := h 1 le_rfl\n  simpa using Finset.card_le_card hS\n\n/-- Every admissible $k$ is at most $f(n)$. -/\n@[category API, AMS 11]\ntheorem le_f {n k : ℕ} (h : IsAdmissible n k) : k ≤ f n :=\n  le_csSup ⟨n, fun _ hk => IsAdmissible.le hk⟩ h\n\n/--\nLet $f(n)$ be maximal such that, for every $m\\geq 1$, there exists some\n$S\\subseteq \\{1,\\ldots,n\\}$ with $\\lvert S\\rvert=f(n)$ such that $m\\neq \\sum_{a\\in A}a$ for all\n$A\\subseteq S$.\n\nIs it true that\n$$f(n) = \\left(\\frac{1}{2}+o(1)\\right)\\frac{n}{\\log n}?$$\n\nThe answer is yes: the lower bound is due to Erdős and Graham and the upper bound to Alon and\nFreiman [AlFr88].\n-/\n@[category research solved, question, AMS 11]\ntheorem erdos_771 :\n    (fun n : ℕ ↦ (f n : ℝ)) ~[atTop] fun n : ℕ ↦ (n : ℝ) / (2 * Real.log n) := by\n  sorry\n\n/--\nErdős and Graham proved the lower bound\n$$f(n)\\geq \\left(\\frac{1}{2}+o(1)\\right)\\frac{n}{\\log n}.$$\nTheir proof is to note that we can assume that $m< \\binom{n+1}{2}$ and then, for any $m$, take\n$S=\\{ kp : 1\\leq k<\\frac{n}{p}\\}$ where $p$ is the least prime that does not divide $m$\n(so $p<(2+o(1))\\log n$).\n-/\n@[category research solved, AMS 11]\ntheorem erdos_771.variants.erdos_graham_lower :\n    ∀ ε : ℝ, 0 < ε → ∀ᶠ n : ℕ in atTop, (1 / 2 - ε) * ((n : ℝ) / Real.log n) ≤ f n := by\n  sorry\n\n/--\nThe complementary bound\n$$f(n) \\leq \\left(\\frac{1}{2}+o(1)\\right)\\frac{n}{\\log n}$$\nwas proved by Alon and Freiman [AlFr88], who chose $m$ as the least common multiple of\n$\\{1,\\ldots,s\\}$ where $s$ is maximal such that $m\\leq \\frac{n^2}{20(\\log n)^2}$.\n-/\n@[category research solved, AMS 11]\ntheorem erdos_771.variants.alon_freiman_upper :\n    ∀ ε : ℝ, 0 < ε → ∀ᶠ n : ℕ in atTop, (f n : ℝ) ≤ (1 / 2 + ε) * ((n : ℝ) / Real.log n) := by\n  sorry\n\nend Erdos771\n",
  "statement_hash": "a273b96d5ac7f21418a20f10d68bc9f8a9de06a399f02bfa22cbb782c3c20e75",
  "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."
}