/- 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 346 *References:* - [erdosproblems.com/346](https://www.erdosproblems.com/346) - [Gr64d] Graham, R. L., A property of Fibonacci numbers. Fibonacci Quart. (1964), 1-10. - [ErGr80] Erdős, P. and Graham, R., Old and new problems and results in combinatorial number theory. Monographies de L'Enseignement Mathematique (1980). - -/ @[expose] public section open Filter Topology Set namespace Erdos346 /-- Is it true that for every lacunary, strongly complete sequence `A` that is not complete whenever infinitely many terms are removed from it, `lim A (n + 1) / A n = (1 + √5) / 2`? The answer is no. A counterexample recorded at [erdosproblems.com/346] has all successive ratios at least `6 / 5`, but has subsequences of successive ratios tending to two different limits, `(1 + √5) / 2` and `(1 + √5) / 2 + 1 / 4`. -/ @[category research solved, question, AMS 11] theorem erdos_346 : ¬ ∀ {A : ℕ → ℕ}, IsLacunary A → IsAddStronglyCompleteNatSeq A → (∀ B : Set ℕ, B ⊆ range A → B.Infinite → ¬ IsAddComplete (range A \ B)) → Tendsto (fun n => A (n + 1) / (A n : ℝ)) atTop (𝓝 ((1 + √5) / 2)) := by sorry /-- We define a sequence `f` by the formula `f n = n.fib - (- 1) ^ n`. -/ def f (n : ℕ) : ℕ := if Even n then n.fib - 1 else n.fib + 1 /-- The sequence `f` is lacunary. -/ @[category test, AMS 11] theorem erdos_346.variants.f_isLacunary : IsLacunary f := by refine ⟨3/2, by norm_num, Filter.eventually_atTop.mpr ⟨9, fun k hk => ?_⟩⟩ -- Key: `2·fib(k+1) > 3·fib(k) + 5` for `k ≥ 9`, since -- `2·fib(k+1) - 3·fib(k) = fib(k-3) ≥ fib(6) = 8 > 5`. have hfib_strict : 3 * Nat.fib k + 5 < 2 * Nat.fib (k + 1) := by obtain ⟨m, rfl⟩ : ∃ m, k = m + 9 := ⟨k - 9, by omega⟩ have h1 : Nat.fib (m + 9 + 1) = Nat.fib (m + 8) + Nat.fib (m + 9) := by rw [show m + 9 + 1 = m + 8 + 2 from by ring, Nat.fib_add_two] have h2 : Nat.fib (m + 9) = Nat.fib (m + 7) + Nat.fib (m + 8) := by rw [show m + 9 = m + 7 + 2 from by ring, Nat.fib_add_two] have h3 : Nat.fib (m + 8) = Nat.fib (m + 6) + Nat.fib (m + 7) := by rw [show m + 8 = m + 6 + 2 from by ring, Nat.fib_add_two] have h4 : 8 ≤ Nat.fib (m + 6) := le_trans (by decide : 8 ≤ Nat.fib 6) (Nat.fib_mono (by omega)) omega have hfib_R : 3 * (Nat.fib k : ℝ) + 5 < 2 * Nat.fib (k + 1) := by exact_mod_cast hfib_strict have hpos : 1 ≤ Nat.fib k := Nat.fib_pos.mpr (by omega) have hpos1 : 1 ≤ Nat.fib (k + 1) := Nat.fib_pos.mpr (by omega) unfold f by_cases heven : Even k · have hodd : ¬ Even (k + 1) := by simp [Nat.even_add_one, heven] rw [if_pos heven, if_neg hodd] push_cast [Nat.cast_sub hpos] linarith · have hodd_plus : Even (k + 1) := by simp [Nat.even_add_one, heven] rw [if_neg heven, if_pos hodd_plus] push_cast [Nat.cast_sub hpos1] linarith /-- The sequence `f` is strongly complete, and this is proved in [Gr64d]. -/ @[category research solved, AMS 11] theorem erdos_346.variants.f_isAddStronglyCompleteNatSeq : IsAddStronglyCompleteNatSeq f := by sorry /-- The recurrence `f (m + 2) = f (m + 1) + f m - (-1) ^ m` for `m ≥ 1`, written without subtraction. -/ @[category API, AMS 11] theorem erdos_346.variants.f_add_two (m : ℕ) (hm : 1 ≤ m) : f (m + 2) + (if Even m then 1 else 0) = f (m + 1) + f m + (if Even m then 0 else 1) := by have h1 : 1 ≤ Nat.fib m := Nat.fib_pos.2 hm have h2 : 1 ≤ Nat.fib (m + 1) := Nat.fib_pos.2 (by omega) have h3 : Nat.fib (m + 2) = Nat.fib m + Nat.fib (m + 1) := Nat.fib_add_two by_cases he : Even m · have he1 : ¬ Even (m + 1) := by simp [Nat.even_add_one, he] have he2 : Even (m + 2) := by simp [Nat.even_add, he] simp only [f, if_pos he, if_neg he1, if_pos he2] omega · have he1 : Even (m + 1) := by simp [Nat.even_add_one, he] have he2 : ¬ Even (m + 2) := by simp [Nat.even_add, he] simp only [f, if_neg he, if_pos he1, if_neg he2] omega /-- `f 0 + ⋯ + f (m - 1) = f (m + 1) - [m even]` for `m ≥ 1`; this is [Gr64d, Eq. (1)]. -/ @[category API, AMS 11] theorem erdos_346.variants.sum_range_f (m : ℕ) (hm : 1 ≤ m) : ∑ i ∈ Finset.range m, f i + (if Even m then 1 else 0) = f (m + 1) := by induction m with | zero => omega | succ k ih => rcases Nat.eq_zero_or_pos k with rfl | hk · decide · have h1 := ih hk have h2 : f (k + 1 + 1) + (if Even k then 1 else 0) = f (k + 1) + f k + (if Even k then 0 else 1) := erdos_346.variants.f_add_two k hk have hpar : (if Even (k + 1) then 1 else 0) + (if Even k then 1 else 0) = 1 := by by_cases he : Even k <;> simp [Nat.even_add_one, he] have hpar' : (if Even k then 1 else 0) + (if Even k then 0 else 1) = 1 := by split_ifs <;> rfl rw [Finset.sum_range_succ] omega /-- `f` is strictly increasing from index `4` on. -/ @[category API, AMS 11] theorem erdos_346.variants.f_strictMono : StrictMono fun k => f (4 + k) := by refine strictMono_nat_of_lt_succ fun k => ?_ show f (4 + k) < f (4 + (k + 1)) have h := erdos_346.variants.f_add_two (3 + k) (by omega) have hf : 2 ≤ f (3 + k) := by have h2 : 2 ≤ Nat.fib (3 + k) := le_trans (by decide : 2 ≤ Nat.fib 3) (Nat.fib_mono (by omega)) by_cases he : Even (3 + k) · have h4 : 4 ≤ 3 + k := by rcases Nat.even_iff.1 he with h omega have h3 : 3 ≤ Nat.fib (3 + k) := le_trans (by decide : 3 ≤ Nat.fib 4) (Nat.fib_mono h4) simp only [f, if_pos he] omega · simp only [f, if_neg he] omega rw [show 4 + (k + 1) = 3 + k + 2 by omega, show 4 + k = 3 + k + 1 by omega] split_ifs at h <;> omega /-- The sequence `f` is not complete whenever infinitely many terms are removed from it, and this is proved in [Gr64d]. -/ @[category research solved, AMS 11] theorem erdos_346.variants.f_not_isAddComplete {B : Set ℕ} (h : B ⊆ range f) (hB : B.Infinite) : ¬ IsAddComplete (range f \ B) := not_isAddComplete_range_diff_of_sum_range_le (n₀ := 4) erdos_346.variants.f_strictMono (fun m hm => by have := erdos_346.variants.sum_range_f m (by omega); omega) h hB /-- Erdős and Graham [ErGr80] remark that it is easy to see that if `A (n + 1) / A n > (1 + √5) / 2` then the second property is automatically satisfied. -/ @[category research solved, AMS 11] theorem erdos_346.variants.gt_goldenRatio_not_IsAddComplete {A : ℕ → ℕ} (hA : ∀ n, (1 + √5) / 2 * A n < A (n + 1)) {B : Set ℕ} (h : B ⊆ range A) (hB : B.Infinite) : ¬ IsAddComplete (range A \ B) := by -- Since `φ² = φ + 1`, the hypothesis gives `A (n + 2) > φ A (n + 1) > A (n + 1) + A n`, so the -- partial sums satisfy `A 0 + ⋯ + A (m - 1) ≤ A (m + 1)`, and the general lemma applies. have hs5 : (2 : ℝ) < √5 := by have h4 : √(4 : ℝ) = 2 := by rw [show (4 : ℝ) = 2 ^ 2 by norm_num, Real.sqrt_sq (by norm_num)] linarith [Real.sqrt_lt_sqrt (by norm_num : (0 : ℝ) ≤ 4) (by norm_num : (4 : ℝ) < 5)] have hs5sq : √5 * √5 = (5 : ℝ) := Real.mul_self_sqrt (by norm_num) have hlt : ∀ n, A n < A (n + 1) := fun n => by have h1 := hA n have h0 : (0 : ℝ) ≤ A n := by positivity exact_mod_cast (show (A n : ℝ) < A (n + 1) by nlinarith) have hfib : ∀ n, A (n + 1) + A n < A (n + 2) := fun n => by have h1 := hA n have h2 := hA (n + 1) have h0 : (0 : ℝ) ≤ A n := by positivity have h0' : (0 : ℝ) ≤ A (n + 1) := by positivity exact_mod_cast (show (A (n + 1) : ℝ) + A n < A (n + 2) by nlinarith) have hsum : ∀ m, ∑ i ∈ Finset.range m, A i ≤ A (m + 1) := by intro m induction m with | zero => simp | succ k ih => have := hfib k rw [Finset.sum_range_succ, show k + 1 + 1 = k + 2 by omega] omega exact not_isAddComplete_range_diff_of_sum_range_le (n₀ := 0) (by simpa using strictMono_nat_of_lt_succ hlt) (fun m _ => hsum m) h hB /-- Erdős and Graham [ErGr80] also say that it is not hard to construct very irregular sequences satisfying the aforementioned properties: there is a strictly increasing sequence `A` that is strongly complete and not complete whenever infinitely many terms are removed from it, but with $\liminf_n A(n+1)/A(n) = 1$ and $\limsup_n A(n+1)/A(n) = \infty$. -/ @[category research solved, AMS 11] theorem erdos_346.variants.example : ∃ A : ℕ → ℕ, StrictMono A ∧ IsAddStronglyCompleteNatSeq A ∧ (∀ B : Set ℕ, B ⊆ range A → B.Infinite → ¬ IsAddComplete (range A \ B)) ∧ liminf (fun n => A (n + 1) / (A n : ℝ)) atTop = 1 ∧ limsup (fun n => A (n + 1) / (A n : ENNReal)) atTop = ⊤ := by sorry end Erdos346