/- Copyright 2026 The Formal Conjectures Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -/ import FormalConjecturesUtil

Erdős Problem 700

Reference: erdosproblems.com/700

A problem of Erdős and Szekeres [ErSz78].

References:

    [ErSz78] Erdős, P. and Szekeres, G., Some number theoretic problems on binomial coefficients, Austral. Math. Soc. Gaz. (1978), 97-99.

    OEIS A091963

    Guy, R. K., Unsolved Problems in Number Theory, B31, B33.

namespace Erdos700open Finset

f n = min_{1 < k ≤ n/2} gcd(n, C(n,k)). (The infimum is 0 when the range is empty, i.e. n < 4.)

noncomputable def f (n : ) : := sInf {m | k, 1 < k k n / 2 m = Nat.gcd n (n.choose k)}

P n is the largest prime factor of n (and 0 if n ≤ 1).

noncomputable def P (n : ) : := n.primeFactors.sup id

The set whose infimum defines f.

def fSet (n : ) : Set := {m | k, 1 < k k n / 2 m = Nat.gcd n (n.choose k)}

f n unfolds to the infimum of fSet n.

@[category API, AMS 11] lemma f_eq (n : ) : f n = sInf (fSet n) := rfl

Each gcd(n, C(n,k)) with 1 < k ≤ n/2 belongs to fSet n.

@[category API, AMS 11] lemma f_mem (n k : ) (h1 : 1 < k) (h2 : k n / 2) : Nat.gcd n (n.choose k) fSet n := k, h1, h2, rfl

f n is a lower bound: f n ≤ gcd(n, C(n,k)) for every 1 < k ≤ n/2.

@[category API, AMS 11] lemma f_le (n k : ) (h1 : 1 < k) (h2 : k n / 2) : f n Nat.gcd n (n.choose k) := Nat.sInf_le (f_mem n k h1 h2)

Let $f(n) = \min_{1 < k \le n/2} \gcd(n, \binom{n}{k})$ and let $P(n)$ be the largest prime dividing $n$.

(a) Characterise those composite $n$ such that $f(n) = n/P(n)$.

Erdős–Szekeres [ErSz78] note that $f(n) = n/P(n)$ when $n$ is a product of two primes (erdos_700.variants.prime_mul), with $n = 30$ a further example. The characterisation itself is open; we state it as the (unknown) predicate that is equivalent to being such an n.

@[category research open, AMS 11] theorem erdos_700.parts.i (n : ) (hn : ¬ n.Prime) (hn1 : 1 < n) : f n = n / P n answer(sorry) := n:hn:¬Nat.Prime nhn1:1 < nf n = n / P n True All goals completed! 🐙

Let $f(n) = \min_{1 < k \le n/2} \gcd(n, \binom{n}{k})$.

(b) Are there infinitely many composite $n$ such that $f(n) > n^{1/2}$?

Erdős–Szekeres [ErSz78] could not prove this. (Since $f(n) \ge p(n)$, the least prime factor of $n$, there are infinitely many $n$ — those of the form $p^2$ — with $f(n) \ge n^{1/2}$; the question asks for the strict inequality.) Here $f(n) > n^{1/2}$ is written as (f n) ^ 2 > n.

@[category research open, AMS 11] theorem erdos_700.parts.ii : answer(sorry) {n : | ¬ n.Prime 1 < n (f n) ^ 2 > n}.Infinite := True {n | ¬Nat.Prime n 1 < n f n ^ 2 > n}.Infinite All goals completed! 🐙

Let $f(n) = \min_{1 < k \le n/2} \gcd(n, \binom{n}{k})$.

(c) Is it true that, for every composite $n$, $f(n) \ll_A n/(\log n)^A$ for every $A > 0$?

Erdős–Szekeres [ErSz78] prove the weaker bound $f(n) \le (1 + o(1)) n/\log n$ (the case $A = 1$). Here $f(n) \ll_A n/(\log n)^A$ is spelled out as: for every A > 0 there is a constant C (depending on A) with f(n) ≤ C · n/(log n)^A for every composite n.

@[category research open, AMS 11] theorem erdos_700.parts.iii : answer(sorry) ( A : , 0 < A C : , 0 < C n : , ¬ n.Prime 1 < n (f n : ) C * (n : ) / (Real.log n) ^ A) := True (A : ), 0 < A C, 0 < C (n : ), ¬Nat.Prime n 1 < n (f n) C * n / Real.log n ^ A All goals completed! 🐙

Lucas (one step): for prime P ∣ n, if P ∤ C(n,k) then P ∣ k.

P:n:k:hP:Nat.Prime PhPn:P nh:¬P n.choose kthis:Fact (Nat.Prime P)hk:¬P khmod:n.choose k 0 [MOD P]hn0:n % P = 0hkP:0 < k % PP n.choose k All goals completed! 🐙

f(p^a) = p for a prime p and a ≥ 2 (recorded by Erdős–Szekeres [ErSz78]). In particular, since (p^a) / P(p^a) = p^{a-1}, the prime power p^a is a "hit" (f(n) = n / P(n)) if and only if a = 2.

p:a:hp:Nat.Prime pha:2 ahp2:2 pk: := p ^ (a - 1)hk:k = p ^ (a - 1)hk0:k 0hkn:k p ^ ahk1:1 < khk2:k p ^ a / 2hknne:k p ^ ahcpos:0 < (p ^ a).choose khkfact:k.factorization p = a - 1hvp:((p ^ a).choose k).factorization p = 1hgcd:(p ^ a).gcd ((p ^ a).choose k) = phle:f (p ^ a) phge:p f (p ^ a)f (p ^ a) = p All goals completed! 🐙

f(pq) = p for distinct primes p < q (recorded by Erdős–Szekeres [ErSz78]); in particular pq is always a "hit" (f(pq) = pq / P(pq) = p). Proof via Lucas' theorem: p ∤ C(pq,k) ⟹ p ∣ k (and the same for q), so any k with gcd(pq, C(pq,k)) = 1 must be a multiple of pq, of which there are none in (1, pq/2]; the witness k = q gives gcd(pq, C(pq,q)) = p.

p:q:hp:Nat.Prime phq:Nat.Prime qhpq:p < qthis✝:Fact (Nat.Prime p)this:Fact (Nat.Prime q)hp2:2 phq2:2 qhpndq:¬p qhk1:1 < qhk2:q p * q / 2hpC:p (p * q).choose qhqC:¬q (p * q).choose qhgcd:(p * q).gcd ((p * q).choose q) = phle:f (p * q) phge:p f (p * q)f (p * q) = p All goals completed! 🐙end Erdos700