{
  "id": "2479",
  "ident": "NS.02479",
  "slug": "erdos-56",
  "title": "Erdős Problem 56",
  "status": "solved",
  "statement_status": "reviewed",
  "statement_md": "Suppose $A \\subseteq \\{1,\\dots,N\\}$ is such that there are no $k+1$ elements of $A$ which are\nrelatively prime. An example is the set of all multiples of the first $k$ primes.\nIs this the largest such set?  To avoid trivial counterexamples, we must insist that $N$ be at\nleast the $k$th prime.",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [
    "question",
    "formal_proof"
  ],
  "collection": "erdos",
  "source_url": "https://www.erdosproblems.com/56",
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "Erdos56.erdos_56",
  "statement_lean": "theorem erdos_56 : ¬ ∀ᵉ (k > 0) (N ≥ (k-1).nth Nat.Prime),\n    (MaxWeaklyDivisible N k = (FirstPrimesMultiples N k).card)",
  "challenge_source": "/-\nCopyright 2025 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 56\n\n*Reference:* [erdosproblems.com/56](https://www.erdosproblems.com/56)\n-/\n\n@[expose] public section\n\nopen scoped Finset\nnamespace Erdos56\n\n/--\nSay a set of natural numbers is `k`-weakly divisible if any `k+1` elements\nof `A` are not relatively prime.\n-/\ndef WeaklyDivisible (k : ℕ) (A : Finset ℕ) : Prop :=\n    ∀ s ∈ A.powersetCard (k + 1), ¬ Set.Pairwise s Nat.Coprime\n\n@[category API, AMS 11]\nlemma weaklyDivisible_empty (k : ℕ): WeaklyDivisible k {} := by\n  simp [WeaklyDivisible]\n\n/-- A singleton is `k`-weakly divisible if `k ≠ 0`. -/\n@[category API, AMS 11]\nlemma weaklyDivisible_singleton {k : ℕ} (hk : k ≠ 0) (l : ℕ) : WeaklyDivisible k {l} := by\n  simp [WeaklyDivisible, hk]\n\n/-- No non-empty set is `1`-weakly divisible. -/\n@[category API, AMS 11]\nlemma not_weaklyDivisible_zero {A : _} (h : A.Nonempty) : ¬WeaklyDivisible 0 A := by\n  simpa [WeaklyDivisible] using ⟨{_}, by simpa using h.choose_spec⟩\n\n@[category API, AMS 11]\nlemma empty_iff_weaklyDivisible_zero {A : _} : WeaklyDivisible 0 A ↔ A = ∅ :=\n  ⟨fun h ↦ Finset.not_nonempty_iff_eq_empty.1 <| mt not_weaklyDivisible_zero (not_not.2 h),\n    fun h ↦ h ▸ weaklyDivisible_empty _⟩\n\n/--\n`MaxWeaklyDivisible N k` is the size of the largest k-weakly divisible subset of `{1,..., N}`\n-/\nnoncomputable def MaxWeaklyDivisible (N : ℕ) (k : ℕ) : ℕ :=\n  sSup {#A | (A : Finset ℕ) (_ : A ⊆ Finset.Icc 1 N) (_ : WeaklyDivisible k A)}\n\n@[category test, AMS 11]\ntheorem maxWeaklyDivisible_zero : ∀ k : ℕ, MaxWeaklyDivisible 0 k = 0 := by\n  intro k\n  simp [MaxWeaklyDivisible, Nat.sSup_def]\n\n@[category test, AMS 11]\ntheorem maxWeaklyDivisible_one {k : ℕ} (hk : k ≠ 0) : MaxWeaklyDivisible 1 k = 1 := by\n  have : {x | ∃ A, WeaklyDivisible k A ∧ (A = ∅ ∨ A = {1}) ∧ #A = x} = {0, 1} := by\n    refine Set.ext fun _ => ⟨fun _ => by aesop, ?_⟩\n    rintro ⟨_, _⟩\n    · simpa using weaklyDivisible_empty k\n    · exact ⟨{1}, by simp_all [weaklyDivisible_singleton hk 1]⟩\n  simp_all [MaxWeaklyDivisible]\n\n@[category test, AMS 11]\ntheorem maxWeaklyDivisible_zero_k (N : ℕ) : MaxWeaklyDivisible N 0 = 0 := by\n  simp [empty_iff_weaklyDivisible_zero, MaxWeaklyDivisible]\n\n/--\n`FirstPrimesMultiples N k` is the set of numbers in `{1,..., N}` that are\na multiple of one of the first `k` primes.\n-/\nnoncomputable def FirstPrimesMultiples (N k : ℕ) : Finset ℕ :=\n    (Finset.Icc 1 N).filter fun i => ∃ j < k, (j.nth Nat.Prime ∣ i)\n\n@[category test, AMS 11]\ntheorem firstPrimesMultiples_one_card_zero (k : ℕ) : (FirstPrimesMultiples 1 k).card = 0 := by\n  simp [FirstPrimesMultiples, Finset.filter_singleton]\n  intro n h\n  by_contra hprime\n  have : Nat.Prime 1 := by\n    convert Nat.prime_nth_prime n\n    exact hprime.symm\n  tauto\n\n@[category test, AMS 11]\ntheorem firstPrimesMultiples_zero_k_card_zero (N : ℕ) : (FirstPrimesMultiples N 0).card = 0 := by\n  simp [FirstPrimesMultiples]\n\n/--\nAn example of a `k`-weakly divisible set is the subset of `{1, ..., N}`\ncontaining the multiples of the first `k` primes.\n-/\n@[category API, AMS 11]\nlemma weaklyDivisible_firstPrimesMultiples (N k : ℕ) :\n    WeaklyDivisible k (FirstPrimesMultiples N k) := by\n  unfold WeaklyDivisible\n  intro s hs\n  rw [Finset.mem_powersetCard] at hs\n  -- Define the map from s to Fin k\n  set f : s → Fin k := fun ⟨x, hx⟩ =>\n    have h_exists := (Finset.mem_filter.mp (hs.1 hx)).2\n    ⟨Classical.choose h_exists, (Classical.choose_spec h_exists).1⟩\n  have hcard_s : Fintype.card s = k + 1 := by simp [hs.2]\n  have hcard_fink : Fintype.card (Fin k) = k := Fintype.card_fin k\n  obtain ⟨x, y, hne, heq⟩ := Fintype.exists_ne_map_eq_of_card_lt f (by omega)\n  intro h_pair\n  have hne_val : x.1 ≠ y.1 := by\n    intro h_eq\n    exact hne (Subtype.ext h_eq)\n  have h_coprime := h_pair x.2 y.2 hne_val\n  set p := (f x).val.nth Nat.Prime\n  have hp_prime : p.Prime := Nat.prime_nth_prime _\n  have hp_div_x : p ∣ x.1 := by\n    have h_exists := (Finset.mem_filter.mp (hs.1 x.2)).2\n    exact (Classical.choose_spec h_exists).2\n  have hp_div_y : p ∣ y.1 := by\n    have h_exists := (Finset.mem_filter.mp (hs.1 y.2)).2\n    have h_eq_f : (f x).val = (f y).val := by rw [heq]\n    -- (f y).val is Classical.choose h_exists by definition\n    have : p = (Classical.choose h_exists).nth Nat.Prime := by\n      dsimp [p]\n      rw [h_eq_f]\n    rw [this]\n    exact (Classical.choose_spec h_exists).2\n  have hp_div_gcd : p ∣ x.1.gcd y.1 := Nat.dvd_gcd hp_div_x hp_div_y\n  have h_gcd_eq_one : x.1.gcd y.1 = 1 := h_coprime\n  rw [h_gcd_eq_one] at hp_div_gcd\n  have hp_le_one : p ≤ 1 := Nat.le_of_dvd (by norm_num) hp_div_gcd\n  have : p > 1 := hp_prime.one_lt\n  omega\n\nset_option linter.style.formal_proof_palomar false in\n/--\nSuppose $A \\subseteq \\{1,\\dots,N\\}$ is such that there are no $k+1$ elements of $A$ which are\nrelatively prime. An example is the set of all multiples of the first $k$ primes.\nIs this the largest such set?  To avoid trivial counterexamples, we must insist that $N$ be at\nleast the $k$th prime.\n-/\n@[category research solved, question, AMS 11, formal_proof using lean4 at \"https://github.com/plby/lean-proofs/blob/main/src/v4.24.0/ErdosProblems/Erdos56.lean\"]\ntheorem erdos_56 : ¬ ∀ᵉ (k > 0) (N ≥ (k-1).nth Nat.Prime),\n    (MaxWeaklyDivisible N k = (FirstPrimesMultiples N k).card) := by\n  sorry\n\nend Erdos56\n",
  "statement_hash": "b99d73adf1bdcc0d951f4302ea6be111c85c96c62c90cfbd146f5c8cab422a5b",
  "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."
}