{
  "id": "2919",
  "ident": "NS.02919",
  "slug": "erdos-700",
  "title": "Erdős Problem 700",
  "status": "open",
  "statement_status": "reviewed",
  "statement_md": "Let $f(n) = \\min_{1 < k \\le n/2} \\gcd(n, \\binom{n}{k})$ and let $P(n)$ be the largest prime\ndividing $n$.\n\n**(a)** Characterise those composite $n$ such that $f(n) = n/P(n)$.\n\nErdős–Szekeres [ErSz78] note that $f(n) = n/P(n)$ when $n$ is a product of two primes\n(`erdos_700.variants.prime_mul`), with $n = 30$ a further example. The characterisation itself is\nopen; we state it as the (unknown) set of all composite `n` with `f n = n / P n`.\n\nThis follows the largest-prime reading on erdosproblems.com. In [ErSz78, p. 98], the first prose\nline below (7) reads: \"where $P(n)$ is the greatest prime power which divides $n$.\"\nThe paper's reading is stated with $Q(n)$ in `erdos_700.variants.prime_power_divisor`.",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [
    "question"
  ],
  "collection": "erdos",
  "source_url": "https://www.erdosproblems.com/700",
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "Erdos700.erdos_700.parts.i",
  "statement_lean": "theorem erdos_700.parts.i :\n    {n : ℕ | ¬ n.Prime ∧ 1 < n ∧ f n = n / P n} = erdos_700.parts.i.answer",
  "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 700\n\n*Reference:* [erdosproblems.com/700](https://www.erdosproblems.com/700)\n\nA problem of Erdős and Szekeres [ErSz78].\n\n*References:*\n * [ErSz78] Erdős, P. and Szekeres, G., _Some number theoretic problems on binomial coefficients_,\n   Austral. Math. Soc. Gaz. (1978), 97-99.\n * [OEIS A091963](https://oeis.org/A091963)\n * Guy, R. K., _Unsolved Problems in Number Theory_, B31, B33.\n-/\n\n@[expose] public section\n\nnamespace Erdos700\n\nopen Finset\n\n/-- `f n = min_{1 < k ≤ n/2} gcd(n, C(n,k))`. (The infimum is `0` when the range is empty, i.e.\n`n < 4`.) -/\nnoncomputable def f (n : ℕ) : ℕ :=\n  sInf {m | ∃ k, 1 < k ∧ k ≤ n / 2 ∧ m = Nat.gcd n (n.choose k)}\n\n/-- `P n` is the largest prime factor of `n` (and `0` if `n ≤ 1`). -/\nnoncomputable def P (n : ℕ) : ℕ := n.primeFactors.sup id\n\n/-- $Q(n)$ is the largest prime-power divisor of $n$: the maximum of $p^{v_p(n)}$ over\nprime divisors $p$ of $n$. It is `0` when `n ≤ 1`. -/\nnoncomputable def Q (n : ℕ) : ℕ := n.primeFactors.sup (fun p => p ^ n.factorization p)\n\n/-- The set whose infimum defines `f`. -/\ndef fSet (n : ℕ) : Set ℕ := {m | ∃ k, 1 < k ∧ k ≤ n / 2 ∧ m = Nat.gcd n (n.choose k)}\n\n/-- `f n` unfolds to the infimum of `fSet n`. -/\n@[category API, AMS 11]\nlemma f_eq (n : ℕ) : f n = sInf (fSet n) := rfl\n\n/-- Each `gcd(n, C(n,k))` with `1 < k ≤ n/2` belongs to `fSet n`. -/\n@[category API, AMS 11]\nlemma f_mem (n k : ℕ) (h1 : 1 < k) (h2 : k ≤ n / 2) :\n    Nat.gcd n (n.choose k) ∈ fSet n := ⟨k, h1, h2, rfl⟩\n\n/-- `f n` is a lower bound: `f n ≤ gcd(n, C(n,k))` for every `1 < k ≤ n/2`. -/\n@[category API, AMS 11]\nlemma f_le (n k : ℕ) (h1 : 1 < k) (h2 : k ≤ n / 2) :\n    f n ≤ Nat.gcd n (n.choose k) := Nat.sInf_le (f_mem n k h1 h2)\n\ndef erdos_700.parts.i.answer : Set ℕ := sorry\n\n/-- Let $f(n) = \\min_{1 < k \\le n/2} \\gcd(n, \\binom{n}{k})$ and let $P(n)$ be the largest prime\ndividing $n$.\n\n**(a)** Characterise those composite $n$ such that $f(n) = n/P(n)$.\n\nErdős–Szekeres [ErSz78] note that $f(n) = n/P(n)$ when $n$ is a product of two primes\n(`erdos_700.variants.prime_mul`), with $n = 30$ a further example. The characterisation itself is\nopen; we state it as the (unknown) set of all composite `n` with `f n = n / P n`.\n\nThis follows the largest-prime reading on erdosproblems.com. In [ErSz78, p. 98], the first prose\nline below (7) reads: \"where $P(n)$ is the greatest prime power which divides $n$.\"\nThe paper's reading is stated with $Q(n)$ in `erdos_700.variants.prime_power_divisor`. -/\n@[category research open, question value, AMS 11]\ntheorem erdos_700.parts.i :\n    {n : ℕ | ¬ n.Prime ∧ 1 < n ∧ f n = n / P n} = erdos_700.parts.i.answer := by\n  sorry\n\ndef erdos_700.variants.prime_power_divisor.answer : Set ℕ := sorry\n\n/-- Characterise those composite $n$ such that $f(n) = n/Q(n)$, where $Q(n)$ is the largest\nprime-power divisor of $n$. This is the reading of part (a) in Erdős–Szekeres\n[ErSz78, pp. 98–99](https://combinatorica.hu/~p_erdos/1978-46.pdf). -/\n@[category research open, question value, AMS 11]\ntheorem erdos_700.variants.prime_power_divisor :\n    {n : ℕ | ¬ n.Prime ∧ 1 < n ∧ f n = n / Q n} = erdos_700.variants.prime_power_divisor.answer\n      := by\n  sorry\n\n/-- At $n = 12$, $f(n) = 3 = n/Q(n)$, whereas $n/P(n) = 4$. -/\n@[category test, AMS 11]\ntheorem prime_power_divisor_separation : f 12 = 3 ∧ 12 / P 12 = 4 ∧ 12 / Q 12 = 3 := by\n  refine ⟨le_antisymm ?_ ?_, ?_, ?_⟩\n  · exact f_le 12 4 (by decide) (by decide)\n  · have hne : (fSet 12).Nonempty := ⟨_, f_mem 12 4 (by decide) (by decide)⟩\n    obtain ⟨k, hk1, hk2, hkeq⟩ := Nat.sInf_mem hne\n    rw [f_eq, hkeq]\n    interval_cases k <;> decide\n  · unfold P\n    decide +kernel\n  · unfold Q\n    decide +kernel\n\n/-- Let $f(n) = \\min_{1 < k \\le n/2} \\gcd(n, \\binom{n}{k})$.\n\n**(b)** Are there infinitely many composite $n$ such that $f(n) > n^{1/2}$?\n\nErdős–Szekeres [ErSz78] could not prove this. (Since $f(n) \\ge p(n)$, the least prime factor of\n$n$, there are infinitely many $n$ — those of the form $p^2$ — with $f(n) \\ge n^{1/2}$; the\nquestion asks for the strict inequality.) Here $f(n) > n^{1/2}$ is written as `(f n) ^ 2 > n`. -/\n@[category research open, question, AMS 11]\ntheorem erdos_700.parts.ii :\n    {n : ℕ | ¬ n.Prime ∧ 1 < n ∧ (f n) ^ 2 > n}.Infinite := by\n  sorry\n\n/-- Let $f(n) = \\min_{1 < k \\le n/2} \\gcd(n, \\binom{n}{k})$.\n\n**(c)** Is it true that, for every composite $n$, $f(n) \\ll_A n/(\\log n)^A$ for every $A > 0$?\n\nErdős–Szekeres [ErSz78] prove the weaker bound $f(n) \\le (1 + o(1)) n/\\log n$ (the case $A = 1$).\nHere $f(n) \\ll_A n/(\\log n)^A$ is spelled out as: for every `A > 0` there is a constant `C`\n(depending on `A`) with `f(n) ≤ C · n/(log n)^A` for every composite `n`. -/\n@[category research open, question, AMS 11]\ntheorem erdos_700.parts.iii :\n    (∀ A : ℝ, 0 < A → ∃ C : ℝ, 0 < C ∧ ∀ n : ℕ, ¬ n.Prime → 1 < n →\n      (f n : ℝ) ≤ C * (n : ℝ) / (Real.log n) ^ A) := by\n  sorry\n\n/- ## Proven partial results toward (a) -/\n\n/-- Lucas (one step): for prime `P ∣ n`, if `P ∤ C(n,k)` then `P ∣ k`. -/\n@[category API, AMS 11]\nlemma prime_dvd_of_not_dvd_choose (P n k : ℕ) (hP : P.Prime) (hPn : P ∣ n)\n    (h : ¬ P ∣ n.choose k) : P ∣ k := by\n  have := Fact.mk hP\n  by_contra hk\n  apply h\n  have hmod : n.choose k ≡ (n % P).choose (k % P) * (n / P).choose (k / P) [MOD P] :=\n    Choose.choose_modEq_choose_mod_mul_choose_div_nat\n  have hn0 : n % P = 0 := by\n    have h := (Nat.modEq_zero_iff_dvd).2 hPn; simpa [Nat.ModEq, Nat.zero_mod] using h\n  have hkP : 0 < k % P := Nat.pos_of_ne_zero (fun hh => hk (Nat.dvd_of_mod_eq_zero hh))\n  rw [hn0, Nat.choose_eq_zero_of_lt hkP, zero_mul] at hmod\n  exact (Nat.modEq_zero_iff_dvd).1 hmod\n\n/-- `f(p^a) = p` for a prime `p` and `a ≥ 2` (recorded by Erdős–Szekeres [ErSz78]). In particular,\nsince `(p^a) / P(p^a) = p^{a-1}`, the prime power `p^a` is a \"hit\" (`f(n) = n / P(n)`) if and only\nif `a = 2`. -/\n@[category research solved, AMS 11]\ntheorem erdos_700.variants.prime_pow (p a : ℕ) (hp : p.Prime) (ha : 2 ≤ a) : f (p ^ a) = p := by\n  have hp2 : 2 ≤ p := hp.two_le\n  set k := p ^ (a - 1) with hk\n  have hk0 : k ≠ 0 := (pow_pos hp.pos _).ne'\n  have hkn : k ≤ p ^ a := Nat.pow_le_pow_right hp.pos (by omega)\n  have hk1 : 1 < k := by\n    calc 1 < p := hp.one_lt\n      _ ≤ k := Nat.le_self_pow (by omega) p\n  have hk2 : k ≤ p ^ a / 2 := by\n    have hpa : p ^ a = p * k := by rw [hk, ← pow_succ']; congr 1; omega\n    have : 2 * k ≤ p ^ a := by rw [hpa]; exact Nat.mul_le_mul_right _ hp2\n    omega\n  have hknne : k ≠ p ^ a := by\n    rw [hk]; intro h; exact absurd (Nat.pow_right_injective hp2 h) (by omega)\n  have hcpos : 0 < (p ^ a).choose k := Nat.choose_pos hkn\n  have hkfact : k.factorization p = a - 1 := by\n    rw [hk, Nat.factorization_pow, Nat.Prime.factorization hp]; simp\n  have hvp : ((p ^ a).choose k).factorization p = 1 := by\n    rw [Nat.factorization_choose_prime_pow hp hkn hk0, hkfact]; omega\n  have hgcd : Nat.gcd (p ^ a) ((p ^ a).choose k) = p := by\n    obtain ⟨j, hja, hjeq⟩ := (Nat.dvd_prime_pow hp).1 (Nat.gcd_dvd_left (p ^ a) ((p ^ a).choose k))\n    have hpC : p ∣ (p ^ a).choose k := hp.dvd_choose_pow hk0 hknne\n    have hpg : p ∣ p ^ j := by\n      rw [← hjeq]; exact Nat.dvd_gcd (dvd_pow_self p (by omega)) hpC\n    have hp2C : ¬ (p ^ 2 ∣ (p ^ a).choose k) := by\n      rw [hp.pow_dvd_iff_le_factorization hcpos.ne', hvp]; omega\n    have hp2g : ¬ (p ^ 2 ∣ p ^ j) := by\n      rw [← hjeq]; exact fun h => hp2C (h.trans (Nat.gcd_dvd_right _ _))\n    have hj1 : 1 ≤ j := by\n      rcases Nat.eq_zero_or_pos j with rfl | hj0\n      · rw [pow_zero, Nat.dvd_one] at hpg; omega\n      · exact hj0\n    have hj2 : j ≤ 1 := by\n      by_contra! h\n      exact hp2g ((Nat.pow_dvd_pow_iff_le_right hp.one_lt).2 h)\n    rw [hjeq, show j = 1 from by omega, pow_one]\n  have hle : f (p ^ a) ≤ p := by\n    have hh := f_le (p ^ a) k hk1 hk2; rwa [hgcd] at hh\n  have hge : p ≤ f (p ^ a) := by\n    have hne : (fSet (p ^ a)).Nonempty := ⟨_, f_mem (p ^ a) k hk1 hk2⟩\n    obtain ⟨j, hj1, hj2, hjeq⟩ := Nat.sInf_mem hne\n    have hjne : j ≠ p ^ a := by rintro rfl; omega\n    have hpdvd : p ∣ Nat.gcd (p ^ a) ((p ^ a).choose j) :=\n      Nat.dvd_gcd (dvd_pow_self p (by omega)) (hp.dvd_choose_pow (by omega) hjne)\n    calc p ≤ Nat.gcd (p ^ a) ((p ^ a).choose j) :=\n            Nat.le_of_dvd (Nat.gcd_pos_of_pos_left _ (pow_pos hp.pos a)) hpdvd\n      _ = sInf (fSet (p ^ a)) := hjeq.symm\n      _ = f (p ^ a) := (f_eq _).symm\n  omega\n\n/-- `f(pq) = p` for distinct primes `p < q` (recorded by Erdős–Szekeres [ErSz78]); in particular\n`pq` is always a \"hit\" (`f(pq) = pq / P(pq) = p`). Proof via Lucas' theorem:\n`p ∤ C(pq,k) ⟹ p ∣ k` (and the same for `q`),\nso any `k` with `gcd(pq, C(pq,k)) = 1` must be a multiple of `pq`, of which there are none in\n`(1, pq/2]`; the witness `k = q` gives `gcd(pq, C(pq,q)) = p`. -/\n@[category research solved, AMS 11]\ntheorem erdos_700.variants.prime_mul (p q : ℕ) (hp : p.Prime) (hq : q.Prime) (hpq : p < q) :\n    f (p * q) = p := by\n  have := Fact.mk hp\n  have := Fact.mk hq\n  have hp2 : 2 ≤ p := hp.two_le\n  have hq2 : 2 ≤ q := hq.two_le\n  have hpndq : ¬ p ∣ q := fun h => by\n    have := (Nat.prime_dvd_prime_iff_eq hp hq).1 h; omega\n  have hk1 : 1 < q := by omega\n  have hk2 : q ≤ p * q / 2 := by\n    have : 2 * q ≤ p * q := by nlinarith\n    omega\n  have hpC : p ∣ (p * q).choose q := by\n    by_contra h\n    exact hpndq (prime_dvd_of_not_dvd_choose p (p * q) q hp ⟨q, rfl⟩ h)\n  have hqC : ¬ q ∣ (p * q).choose q := by\n    have hmod : (p * q).choose q ≡\n        ((p * q) % q).choose (q % q) * ((p * q) / q).choose (q / q) [MOD q] :=\n      Choose.choose_modEq_choose_mod_mul_choose_div_nat\n    rw [Nat.mul_mod_left, Nat.mod_self, Nat.choose_zero_right,\n        Nat.mul_div_cancel _ (by omega : 0 < q), Nat.div_self (by omega : 0 < q),\n        Nat.choose_one_right, one_mul] at hmod\n    intro hdvd\n    have h0 : (p * q).choose q ≡ 0 [MOD q] := (Nat.modEq_zero_iff_dvd).2 hdvd\n    have hp0 : q ∣ p := (Nat.modEq_zero_iff_dvd).1 (hmod.symm.trans h0)\n    have := Nat.le_of_dvd (by omega) hp0\n    omega\n  have hgcd : Nat.gcd (p * q) ((p * q).choose q) = p := by\n    have hpg : p ∣ Nat.gcd (p * q) ((p * q).choose q) := Nat.dvd_gcd ⟨q, rfl⟩ hpC\n    obtain ⟨e, he⟩ := hpg\n    have hgdvd : Nat.gcd (p * q) ((p * q).choose q) ∣ p * q := Nat.gcd_dvd_left _ _\n    rw [he] at hgdvd\n    have hedvd : e ∣ q := (Nat.mul_dvd_mul_iff_left (by omega : 0 < p)).1 hgdvd\n    rcases (Nat.Prime.eq_one_or_self_of_dvd hq e hedvd) with he1 | heq\n    · rw [he, he1, mul_one]\n    · exfalso\n      have hqg : q ∣ Nat.gcd (p * q) ((p * q).choose q) := by rw [he, heq]; exact ⟨p, by ring⟩\n      exact hqC (hqg.trans (Nat.gcd_dvd_right _ _))\n  have hle : f (p * q) ≤ p := by have := f_le (p * q) q hk1 hk2; rwa [hgcd] at this\n  have hge : p ≤ f (p * q) := by\n    have hne : (fSet (p * q)).Nonempty := ⟨_, f_mem (p * q) q hk1 hk2⟩\n    obtain ⟨k, hk1', hk2', hkeq⟩ := Nat.sInf_mem hne\n    rw [f_eq, hkeq]\n    set g := Nat.gcd (p * q) ((p * q).choose k) with hgdef\n    have hgpos : 0 < g := Nat.gcd_pos_of_pos_left _ (by positivity)\n    have hg1 : g ≠ 1 := by\n      intro hg\n      have hpnd : ¬ p ∣ (p * q).choose k := fun hd => by\n        have : p ∣ g := Nat.dvd_gcd ⟨q, rfl⟩ hd\n        rw [hg] at this; exact absurd (Nat.le_of_dvd one_pos this) (by omega)\n      have hqnd : ¬ q ∣ (p * q).choose k := fun hd => by\n        have : q ∣ g := Nat.dvd_gcd ⟨p, by ring⟩ hd\n        rw [hg] at this; exact absurd (Nat.le_of_dvd one_pos this) (by omega)\n      have hpk : p ∣ k := prime_dvd_of_not_dvd_choose p (p * q) k hp ⟨q, rfl⟩ hpnd\n      have hqk : q ∣ k := prime_dvd_of_not_dvd_choose q (p * q) k hq ⟨p, by ring⟩ hqnd\n      have hpqk : p * q ∣ k := Nat.Coprime.mul_dvd_of_dvd_of_dvd\n        ((Nat.coprime_primes hp hq).2 (by omega)) hpk hqk\n      have hkpos : 0 < k := by omega\n      have h1 : p * q ≤ k := Nat.le_of_dvd hkpos hpqk\n      have h2 : k ≤ p * q / 2 := hk2'\n      omega\n    have hgdvd : g ∣ p * q := Nat.gcd_dvd_left _ _\n    obtain ⟨P, hP, hPg⟩ := Nat.exists_prime_and_dvd hg1\n    have hPpq : P ∣ p * q := hPg.trans hgdvd\n    have hPpq2 : P = p ∨ P = q := by\n      rcases (hP.dvd_mul.1 hPpq) with h | h\n      · exact Or.inl ((Nat.prime_dvd_prime_iff_eq hP hp).1 h)\n      · exact Or.inr ((Nat.prime_dvd_prime_iff_eq hP hq).1 h)\n    have hPge : p ≤ P := by rcases hPpq2 with rfl | rfl <;> omega\n    have hPleg : P ≤ g := Nat.le_of_dvd hgpos hPg\n    omega\n  omega\n\nend Erdos700\n",
  "statement_hash": "1d70df03a0efd9442a96ec02cfa0e029ef2238efb7b1ed9e587b1de322eda88b",
  "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."
}