/- 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 456 *References:* - [erdosproblems.com/456](https://www.erdosproblems.com/456) - [Er79e] Erdős, Paul, Some unconventional problems in number theory. Astérisque (1979), 73--82. -/ @[expose] public section open Nat Filter open scoped Topology Asymptotics namespace Erdos456 /-- Let $p_n$ be the smallest prime $\equiv 1\pmod{n}$. -/ noncomputable def p (n : ℕ) : ℕ := sInf { k | k.Prime ∧ k ≡ 1 [MOD n] } /-- Let $m_n$ be the smallest integer such that $n\mid \phi(m_n)$. -/ noncomputable def m (n : ℕ) : ℕ := sInf { k | 0 < k ∧ n ∣ totient k } open scoped Classical in /-- Is it true that $m_n 2n. change m (2 ^ k) < p (2 ^ k) have hm : m (2 ^ k) ≤ 2 ^ (k + 1) := by unfold m refine Nat.sInf_le ⟨by positivity, ?_⟩ rw [Nat.totient_prime_pow Nat.prime_two (by omega)] norm_num have hp : 2 ^ (k + 1) + 1 ≤ p (2 ^ k) := by unfold p let q := sInf {x | x.Prime ∧ x ≡ 1 [MOD 2 ^ k]} change 2 ^ (k + 1) + 1 ≤ q have hne : {x | x.Prime ∧ x ≡ 1 [MOD 2 ^ k]}.Nonempty := by obtain ⟨r, _, hr, hmod⟩ := Nat.forall_exists_prime_gt_and_modEq 0 (pow_ne_zero k (by decide)) (Nat.coprime_one_left (2 ^ k)) exact ⟨r, hr, hmod⟩ obtain ⟨hprime, hmod⟩ : q.Prime ∧ q ≡ 1 [MOD 2 ^ k] := Nat.sInf_mem hne rw [Nat.pow_succ] by_contra hbound have hxle : q ≤ 2 ^ k * 2 := by omega have hlower : 2 ^ k + 1 ≤ q := by simpa [add_comm] using hmod.symm.add_le_of_lt hprime.one_lt have hupper : q ≤ 2 ^ k + 1 := (hmod.trans Nat.add_modEq_left.symm).le_of_lt_add (by omega) have hxeq : q = 2 ^ k + 1 := by omega have hkodd : Odd k := ⟨j + 1, by dsimp [k]; omega⟩ have hxeqthree : q = 3 := (hprime.dvd_iff_eq (by decide)).mp (by rw [hxeq] simpa using hkodd.nat_add_dvd_pow_add_pow 2 1) have heighteen : 8 ≤ 2 ^ k := by change 2 ^ 3 ≤ 2 ^ k exact Nat.pow_le_pow_right (by decide) (by dsimp [k]; omega) omega omega open scoped Classical in /-- Erdős [Er79e] writes it is 'easy to show' that $m_n/n \to \infty$ for almost all $n$. -/ @[category research solved, AMS 11] theorem erdos_456.variants.m_div_n : ∃ A : Set ℕ, Tendsto (fun N ↦ (count (· ∈ A) N : ℝ) / N) atTop (𝓝 1) ∧ Tendsto (fun n ↦ (m n : ℝ) / (n : ℝ)) (atTop ⊓ 𝓟 A) atTop := by sorry end Erdos456