/- 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. -/ module public import FormalConjecturesUtil

Erdős Problem 693

References:

    erdosproblems.com/693

    [Er79e] Erdős, Paul, Some unconventional problems in number theory. Astérisque 61 (1979), 73–82. https://www.numdam.org/article/AST_1979__61__73_0.pdf

See also Erdős problem 446.

@[expose] public sectionnamespace Erdos693open Filter

The finite set $A \subseteq [n,n^k]$ from Erdős problem 693.

def divisorWindowSet (k n : ℕ) : Finset ℕ := (Finset.Icc n (n ^ k)).filter fun x ↦ ((Finset.Ioo n (2 * n)).filter fun d ↦ d ∣ x).Nonempty

$x$ and $y$ are consecutive elements of a finite set of natural numbers.

def ConsecutiveIn (A : Finset ℕ) (x y : ℕ) : Prop := x ∈ A ∧ y ∈ A ∧ x < y ∧ ∀ z, z ∈ A → x < z → z < y → False

The maximum gap in the finite set $A$ is at most $B$.

def MaxGapAtMost (A : Finset ℕ) (B : ℝ) : Prop := ∀ x y, ConsecutiveIn A x y → (y - x : ℝ) ≤ B

For $k=n=2$, the divisor-window set is exactly ${3}$.

@[category test, AMS 11] theorem divisorWindowSet_two_two : divisorWindowSet 2 2 = {3} := ⊢ divisorWindowSet 2 2 = {3} All goals completed! 🐙

The open divisor window $(3,6)$ produces exactly $4,5,8$ in $[3,9]$.

@[category test, AMS 11] theorem divisorWindowSet_two_three : divisorWindowSet 2 3 = {4, 5, 8} := ⊢ divisorWindowSet 2 3 = {4, 5, 8} All goals completed! 🐙

The nontrivial gap from $5$ to $8$ has length $3$.

⊢ MaxGapAtMost {4, 5, 8} 3 ∧ ¬MaxGapAtMost {4, 5, 8} 2 ⊢ ∀ (x y : ℕ), x = 4 ∨ x = 5 ∨ x = 8 → y = 4 ∨ y = 5 ∨ y = 8 → x < y → (x < 4 → y ≤ 4) → (x < 5 → y ≤ 5) → (x < 8 → y ≤ 8) → ↑y ≤ 3 + ↑x ⊢ 4 < 4 → (4 < 4 → 4 ≤ 4) → (4 < 5 → 4 ≤ 5) → (4 < 8 → 4 ≤ 8) → ↑4 ≤ 3 + ↑4⊢ 4 < 5 → (4 < 4 → 5 ≤ 4) → (4 < 5 → 5 ≤ 5) → (4 < 8 → 5 ≤ 8) → ↑5 ≤ 3 + ↑4⊢ 4 < 8 → (4 < 4 → 8 ≤ 4) → (4 < 5 → 8 ≤ 5) → (4 < 8 → 8 ≤ 8) → ↑8 ≤ 3 + ↑4⊢ 5 < 4 → (5 < 4 → 4 ≤ 4) → (5 < 5 → 4 ≤ 5) → (5 < 8 → 4 ≤ 8) → ↑4 ≤ 3 + ↑5⊢ 5 < 5 → (5 < 4 → 5 ≤ 4) → (5 < 5 → 5 ≤ 5) → (5 < 8 → 5 ≤ 8) → ↑5 ≤ 3 + ↑5⊢ 5 < 8 → (5 < 4 → 8 ≤ 4) → (5 < 5 → 8 ≤ 5) → (5 < 8 → 8 ≤ 8) → ↑8 ≤ 3 + ↑5⊢ 8 < 4 → (8 < 4 → 4 ≤ 4) → (8 < 5 → 4 ≤ 5) → (8 < 8 → 4 ≤ 8) → ↑4 ≤ 3 + ↑8⊢ 8 < 5 → (8 < 4 → 5 ≤ 4) → (8 < 5 → 5 ≤ 5) → (8 < 8 → 5 ≤ 8) → ↑5 ≤ 3 + ↑8⊢ 8 < 8 → (8 < 4 → 8 ≤ 4) → (8 < 5 → 8 ≤ 5) → (8 < 8 → 8 ≤ 8) → ↑8 ≤ 3 + ↑8 ⊢ 4 < 4 → (4 < 4 → 4 ≤ 4) → (4 < 5 → 4 ≤ 5) → (4 < 8 → 4 ≤ 8) → ↑4 ≤ 3 + ↑4⊢ 4 < 5 → (4 < 4 → 5 ≤ 4) → (4 < 5 → 5 ≤ 5) → (4 < 8 → 5 ≤ 8) → ↑5 ≤ 3 + ↑4⊢ 4 < 8 → (4 < 4 → 8 ≤ 4) → (4 < 5 → 8 ≤ 5) → (4 < 8 → 8 ≤ 8) → ↑8 ≤ 3 + ↑4⊢ 5 < 4 → (5 < 4 → 4 ≤ 4) → (5 < 5 → 4 ≤ 5) → (5 < 8 → 4 ≤ 8) → ↑4 ≤ 3 + ↑5⊢ 5 < 5 → (5 < 4 → 5 ≤ 4) → (5 < 5 → 5 ≤ 5) → (5 < 8 → 5 ≤ 8) → ↑5 ≤ 3 + ↑5⊢ 5 < 8 → (5 < 4 → 8 ≤ 4) → (5 < 5 → 8 ≤ 5) → (5 < 8 → 8 ≤ 8) → ↑8 ≤ 3 + ↑5⊢ 8 < 4 → (8 < 4 → 4 ≤ 4) → (8 < 5 → 4 ≤ 5) → (8 < 8 → 4 ≤ 8) → ↑4 ≤ 3 + ↑8⊢ 8 < 5 → (8 < 4 → 5 ≤ 4) → (8 < 5 → 5 ≤ 5) → (8 < 8 → 5 ≤ 8) → ↑5 ≤ 3 + ↑8⊢ 8 < 8 → (8 < 4 → 8 ≤ 4) → (8 < 5 → 8 ≤ 5) → (8 < 8 → 8 ≤ 8) → ↑8 ≤ 3 + ↑8 All goals completed! 🐙

Let $k \geq 2$ and let $n$ be sufficiently large depending on $k$. Let $A = {a_1 < a_2 < \cdots}$ be the set of integers in $[n,n^k]$ which have a divisor in $(n,2n)$. Is $\max_i (a_{i+1} - a_i) \leq (\log n)^{O(1)}$?

The exponent is independent of $k$, while the threshold for $n$ may depend on $k$ [Er79e, p. 78].

@[category research open, question, AMS 11] theorem erdos_693 : ∃ C : ℕ, ∀ k ≥ 2, ∀ᶠ n in atTop, MaxGapAtMost (divisorWindowSet k n) ((Real.log (n : ℝ)) ^ C) := ⊢ ∃ C, ∀ k ≥ 2, ∀ᶠ (n : ℕ) in atTop, MaxGapAtMost (divisorWindowSet k n) (Real.log ↑n ^ C) All goals completed! 🐙end Erdos693