{
  "id": "3190",
  "ident": "NS.03190",
  "slug": "erdos-786",
  "title": "Erdős Problem 786",
  "status": "open",
  "statement_status": "reviewed",
  "statement_md": "Let $\\epsilon > 0$. Is there some set $A\\subset\\mathbb{N}$ of density $> 1 - \\epsilon$\nsuch that $a_1\\cdots a_r = b_1\\cdots b_s$ with $a_i, b_j\\in A$ can only hold when\n$r = s$?",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [
    "question"
  ],
  "collection": "erdos",
  "source_url": "https://www.erdosproblems.com/786",
  "solved_on_platform": true,
  "needs_answer": false,
  "version": 1,
  "decl_name": "Erdos786.erdos_786.parts.i",
  "statement_lean": "theorem erdos_786.parts.i : ∀ ε > 0, ε ≤ 1 →\n    ∃ (A : Set ℕ) (δ : ℝ), 0 ∉ A ∧ 1 - ε < δ ∧ A.HasDensity δ ∧ A.IsMulCardSet",
  "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 786\n\n*Reference:* [erdosproblems.com/786](https://www.erdosproblems.com/786)\n-/\n\n@[expose] public section\n\nopen Filter Real\n\nopen scoped Topology\n\nnamespace Erdos786\n\nopen Erdos786\n\n-- TODO : add variants that allow repetition.\n-- According to the updated website, Erdos likely intended repetitions to be allowed here\n-- however, the analogous questions without repetition are also open.\n/--\n`Nat.IsMulCardSet A` means that `A` is a set of natural numbers that\nsatisfies the property that $a_1\\cdots a_r = b_1\\cdots b_s$ with $a_i, b_j\\in A$\ncan only hold when $r = s$.\n-/\ndef Set.IsMulCardSet {α : Type*} [CommMonoid α] (A : Set α) :=\n  ∀ (a b : Finset α) (_ :↑a ⊆ A) (_ : ↑b ⊆ A) (_ : a.prod id = b.prod id),\n    a.card = b.card\n\n/--\nLet $\\epsilon > 0$. Is there some set $A\\subset\\mathbb{N}$ of density $> 1 - \\epsilon$\nsuch that $a_1\\cdots a_r = b_1\\cdots b_s$ with $a_i, b_j\\in A$ can only hold when\n$r = s$?\n-/\n@[category research open, question, AMS 11]\ntheorem erdos_786.parts.i : ∀ ε > 0, ε ≤ 1 →\n    ∃ (A : Set ℕ) (δ : ℝ), 0 ∉ A ∧ 1 - ε < δ ∧ A.HasDensity δ ∧ A.IsMulCardSet := by\n  sorry\n\n/--\nIs there some set $A\\subset\\{1, ..., N\\}$ of size $\\geq (1 - o(1))N$ such that\n$a_1\\cdots a_r = b_1\\cdots b_s$ with $a_i, b_j\\in A$ can only hold when\n$r = s$?\n-/\n@[category research open, question, AMS 11]\ntheorem erdos_786.parts.ii :\n    ∃ (A : ℕ → Set ℕ) (f : ℕ → ℝ) (_ : f =o[atTop] (1 : ℕ → ℝ)),\n    ∀ N, A N ⊆ Set.Icc 1 (N + 1) ∧ (1 - f N) * N ≤ (A N).ncard ∧ (A N).IsMulCardSet := by\n  sorry\n\n/--\nAn example of such a set with density $\\frac 1 4$ is given by the integers $\\equiv 2\\pmod{4}$\n-/\n@[category textbook, AMS 11]\ntheorem erdos_786.parts.i.example (A : Set ℕ) (hA : A = { n | n % 4 = 2 }) :\n    A.HasDensity (1 / 4) ∧ A.IsMulCardSet := by\n  subst hA\n  constructor\n  · -- Exactly `(n + 1) / 4` of the naturals below `n` are `≡ 2 (mod 4)`.\n    have hfin : ∀ n : ℕ, ((Finset.range n).filter fun m ↦ m % 4 = 2).card = (n + 1) / 4 := by\n      intro n\n      induction n with\n      | zero => simp\n      | succ n ih =>\n        rw [Finset.range_add_one, Finset.filter_insert]\n        split\n        · rw [Finset.card_insert_of_notMem (by simp)]; omega\n        · omega\n    have hcard : ∀ n : ℕ, ({m : ℕ | m % 4 = 2} ∩ Set.Iio n).ncard = (n + 1) / 4 := by\n      intro n\n      have hset : {m : ℕ | m % 4 = 2} ∩ Set.Iio n\n          = ↑((Finset.range n).filter fun m ↦ m % 4 = 2) := by\n        ext m; simp [Set.mem_Iio, and_comm]\n      rw [hset, Set.ncard_coe_finset, hfin]\n    rw [Set.HasDensity]\n    have hpd : ∀ n : ℕ, ({m : ℕ | m % 4 = 2}).partialDensity Set.univ n\n        = (((n + 1) / 4 : ℕ) : ℝ) / (n : ℝ) := by\n      intro n\n      rw [Set.partialDensity, Set.inter_univ, Set.univ_inter, hcard, Nat.ncard_Iio]\n    simp only [hpd]\n    -- Squeeze `⌊(n + 1) / 4⌋ / n` between `1 / 4 - 1 / n` and `1 / 4 + 1 / n`.\n    have hbdd : ∀ n : ℕ, 1 ≤ n →\n        1 / 4 - 1 / (n : ℝ) ≤ (((n + 1) / 4 : ℕ) : ℝ) / (n : ℝ) ∧\n          (((n + 1) / 4 : ℕ) : ℝ) / (n : ℝ) ≤ 1 / 4 + 1 / (n : ℝ) := by\n      intro n hn\n      have hn0 : (0 : ℝ) < n := by exact_mod_cast hn\n      have h1 : 4 * ((n + 1) / 4) ≤ n + 1 := by omega\n      have h2 : n + 1 < 4 * ((n + 1) / 4) + 4 := by omega\n      have c1 : (4 : ℝ) * (((n + 1) / 4 : ℕ) : ℝ) ≤ (n : ℝ) + 1 := by exact_mod_cast h1\n      have c2 : (n : ℝ) + 1 < 4 * (((n + 1) / 4 : ℕ) : ℝ) + 4 := by exact_mod_cast h2\n      constructor\n      · rw [le_div_iff₀ hn0]; field_simp; linarith\n      · rw [div_le_iff₀ hn0]; field_simp; linarith\n    have hlim : ∀ c : ℝ, Tendsto (fun n : ℕ ↦ 1 / 4 + c * (1 / (n : ℝ))) atTop (𝓝 (1 / 4)) := by\n      intro c\n      simpa using Tendsto.const_add (1 / 4 : ℝ)\n        (Tendsto.const_mul c tendsto_one_div_atTop_nhds_zero_nat)\n    refine tendsto_of_tendsto_of_tendsto_of_le_of_le'\n      (by simpa using hlim (-1)) (by simpa using hlim 1)\n      (eventually_atTop.2 ⟨1, fun n hn ↦ ?_⟩) (eventually_atTop.2 ⟨1, fun n hn ↦ ?_⟩)\n    · simpa using (hbdd n hn).1\n    · simpa using (hbdd n hn).2\n  · -- Every element of the set is exactly divisible by `2`, so the `2`-adic valuation of a\n    -- product of distinct such elements is the number of factors.\n    have key : ∀ s : Finset ℕ, ↑s ⊆ {n : ℕ | n % 4 = 2} →\n        (s.prod id).factorization 2 = s.card := by\n      intro s hs\n      have hmem : ∀ i ∈ s, i % 4 = 2 := fun i hi ↦ hs hi\n      have h0 : ∀ i ∈ s, id i ≠ 0 := fun i hi ↦ by\n        have := hmem i hi; simp only [id]; omega\n      rw [Nat.factorization_prod h0]\n      simp only [Finsupp.finsetSum_apply]\n      rw [Finset.sum_congr rfl (g := fun _ ↦ 1) fun i hi ↦ ?_, Finset.sum_const, smul_eq_mul,\n        mul_one]\n      have h4 := hmem i hi\n      have hi0 : i ≠ 0 := by omega\n      have hd1 : 2 ^ 1 ∣ i := by omega\n      have hd2 : ¬ (2 ^ 2 ∣ i) := by omega\n      rw [Nat.Prime.pow_dvd_iff_le_factorization Nat.prime_two hi0] at hd1\n      rw [Nat.Prime.pow_dvd_iff_le_factorization Nat.prime_two hi0] at hd2\n      simp only [id]\n      omega\n    intro a b ha hb hprod\n    rw [← key a ha, ← key b hb, hprod]\n\n/--\n`consecutivePrimesFrom p k` gives the set of `k + 1` consecutive primes that are at least `p` in\nsize. If `p` is prime then this is the set of `k + 1` consecutive primes `p, p_1, ..., p_k`-/\nnoncomputable def consecutivePrimesFrom (p : ℕ) (k : ℕ) : Finset ℕ :=\n    (Finset.range (k + 1)).image (Nat.nth (fun q ↦ q.Prime ∧ p ≤ q))\n\n@[category API, AMS 11]\ntheorem nth_zero {p : ℕ} (hp : p.Prime) :\n    Nat.nth (fun q ↦ q.Prime ∧ p ≤ q) 0 = p := by\n  simpa [Nat.nth_zero] using IsLeast.csInf_eq <| by\n    aesop (add simp [IsLeast, mem_lowerBounds])\n\n@[category test, AMS 11]\nlemma consecutivePrimesFrom_zero {p : ℕ} (hp : p.Prime) : consecutivePrimesFrom p 0 = {p} := by\n  simpa [consecutivePrimesFrom] using nth_zero hp\n\n@[category test, AMS 11]\nlemma consecutivePrimesFrom_two_one : consecutivePrimesFrom 2 1 = {2, 3} := by\n  have h : Nat.nth (fun q ↦ q.Prime ∧ 2 ≤ q) 1 = 3 := by\n    exact Nat.nth_count (p := (fun q ↦ q.Prime ∧ 2 ≤ q)) (by decide : (3).Prime ∧ 2 ≤ 3)\n  ext q\n  simp only [consecutivePrimesFrom, Finset.mem_image, Finset.mem_range, Finset.mem_insert,\n    Finset.mem_singleton]\n  constructor\n  · rintro ⟨i, hi, hq⟩\n    cases i with\n    | zero => simpa [← hq] using .inl (nth_zero Nat.prime_two)\n    | succ i => grind\n  · rintro (rfl | rfl); exact ⟨0, by grind, nth_zero Nat.prime_two⟩; exact ⟨1, by grind⟩\n\n-- Reworded slightly using https://users.renyi.hu/~p_erdos/1969-14.pdf p. 81\n-- See https://users.renyi.hu/~p_erdos/1965-02.pdf p. 182 for the multiplicity one condition\n/--\nLet $\\epsilon > 0$ be given. Then, for a sufficiently large prime `p`, take the sequence of\nconsecutive primes $p_1 < \\cdots < p_k$ such that\n$$\n\\sum_{i=1}^k \\frac{1}{p_i} < 1 < \\sum_{i=1}^{k + 1} \\frac{1}{p_i},\n$$\nand let $A$ be the set of all naturals divisible by exactly one of $p_1, ..., p_k$ (with\nmultiplicity $1$). Then $A$ has density $> \\frac{1}{e} - \\epsilon$ and has the property\nthat $a_1\\cdots a_r = b_1\\cdots b_s$ with $a_i, b_j\\in A$ can only hold when $r = s$.\n-/\n@[category research solved, AMS 11]\ntheorem erdos_786.parts.i.selfridge (ε : ℝ) (hε : 0 < ε ∧ ε < 1 / rexp 1) :\n    ∀ᶠ (p : ℕ) in atTop, p.Prime → ∃ k,\n      ∑ q ∈ consecutivePrimesFrom p k, (1 : ℝ) / q < 1 ∧\n        1 < ∑ q ∈ consecutivePrimesFrom p (k + 1), (1 : ℝ) / q ∧\n          letI A := { n | ∑ q ∈ consecutivePrimesFrom p k, (n : ℕ).factorization q = 1 }\n          ∃ δ, 1 / rexp 1 - ε < δ ∧ A.HasDensity δ ∧ A.IsMulCardSet := by\n  sorry\n\nend Erdos786\n",
  "statement_hash": "dcab3e2ed5b6e7852acc96f4528ad413902e7245c46bf508bc594a92106330e7",
  "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."
}