{
  "id": "2406",
  "ident": "NS.02406",
  "slug": "erdos-538",
  "title": "Erdős Problem 538",
  "status": "open",
  "statement_status": "reviewed",
  "statement_md": "Let $r\\geq 2$ and suppose that $A\\subseteq\\{1,\\ldots,N\\}$ is such that, for any\n$m$, there are at most $r$ solutions to $m=pa$ where $p$ is prime and $a\\in A$.\nGive the best possible upper bound for $\\sum_{n\\in A}\\frac{1}{n}$.\n\nErdős observed that $\\sum_{n\\in A}\\frac{1}{n}\\ll r\\frac{\\log N}{\\log\\log N}$, and the\norder `Θ_r(log N / loglog N)` is known (see `erdos_538.matching_order`). The best possible\nupper bound is the asymptotic size of the largest reciprocal sum `maxMass r N` over\nadmissible `A`.",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [
    "question"
  ],
  "collection": "erdos",
  "source_url": "https://www.erdosproblems.com/538",
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "Erdos538.erdos_538",
  "statement_lean": "theorem erdos_538 :\n    ∀ r : ℕ, 2 ≤ r → maxMass r ~[atTop] erdos_538.answer r",
  "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 538\n\n*Reference:* [erdosproblems.com/538](https://www.erdosproblems.com/538)\n-/\n\n@[expose] public section\n\nopen Asymptotics Filter\n\nnamespace Erdos538\n\nopen scoped Classical in\n/-- The representations `m = p * a` with `p` prime and `a ∈ A`. -/\ndef representations (A : Finset ℕ) (m : ℕ) : Finset (ℕ × ℕ) :=\n  (Finset.range (m + 1) ×ˢ A).filter (fun pa => Nat.Prime pa.1 ∧ m = pa.1 * pa.2)\n\n/-- `A ⊆ {1, …, N}` and every `m` has at most `r` representations `m = p a`. -/\ndef Admissible (r N : ℕ) (A : Finset ℕ) : Prop :=\n  (∀ a ∈ A, 1 ≤ a ∧ a ≤ N) ∧ ∀ m : ℕ, (representations A m).card ≤ r\n\n/-- The reciprocal sum `∑_{n ∈ A} 1/n` of the problem. -/\ndef reciprocalMass (A : Finset ℕ) : ℚ := ∑ a ∈ A, (1 : ℚ) / a\n\n/-- The largest reciprocal sum `∑_{n ∈ A} 1/n` over admissible `A ⊆ {1, …, N}`. -/\nnoncomputable def maxMass (r N : ℕ) : ℝ :=\n  sSup ((fun A => (reciprocalMass A : ℝ)) '' {A : Finset ℕ | Admissible r N A})\n\ndef erdos_538.answer : ℕ → ℕ → ℝ := sorry\n\n/--\nLet $r\\geq 2$ and suppose that $A\\subseteq\\{1,\\ldots,N\\}$ is such that, for any\n$m$, there are at most $r$ solutions to $m=pa$ where $p$ is prime and $a\\in A$.\nGive the best possible upper bound for $\\sum_{n\\in A}\\frac{1}{n}$.\n\nErdős observed that $\\sum_{n\\in A}\\frac{1}{n}\\ll r\\frac{\\log N}{\\log\\log N}$, and the\norder `Θ_r(log N / loglog N)` is known (see `erdos_538.matching_order`). The best possible\nupper bound is the asymptotic size of the largest reciprocal sum `maxMass r N` over\nadmissible `A`.\n-/\n@[category research open, question value, AMS 11]\ntheorem erdos_538 :\n    ∀ r : ℕ, 2 ≤ r → maxMass r ~[atTop] erdos_538.answer r := by\n  sorry\n\nset_option linter.style.formal_proof_palomar false in\n/--\nThe reciprocal sum has matching order `Θ_r(log N / loglog N)`: an explicit\nupper bound for every admissible `A`, together with a witnessing construction\nachieving the same order. This pins the order (up to the one iterated-logarithm\nfactor) but not the best possible upper bound asked for in `erdos_538`.\n-/\n@[category research solved, AMS 11, formal_proof using lean4 at \"https://github.com/williamjblair/lean-proofs/blob/4f915a323443bfb1709a6805a013812016dca88a/starfleet/erdos-538/Research/FinalMatchingOrder.lean\"]\ntheorem erdos_538.matching_order (r N : ℕ) (hr : 2 ≤ r) (hN : 2 ≤ N) :\n    (∀ A : Finset ℕ, Admissible r N A →\n      Real.log (Real.log (N + 1)) * (reciprocalMass A : ℝ) ≤\n        2 * r * (1 + Real.log (N * N))) ∧\n    (∃ A : Finset ℕ, Admissible r N A ∧\n      Real.log (N + 1) ≤\n        4 + (8192 * (Nat.log 2 (Nat.log 2 N) + 1) : ℝ) * (reciprocalMass A : ℝ)) := by\n  sorry\n\nend Erdos538\n",
  "statement_hash": "46907a40cea7b4eaef8a70e816179d1a3ef5f25f6dd1f6e3aa13135c629a8774",
  "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."
}