{
  "id": "2191",
  "ident": "NS.02191",
  "slug": "erdos-456",
  "title": "Erdős Problem 456",
  "status": "open",
  "statement_status": "reviewed",
  "statement_md": "Is it true that $m_n<p_n$ for almost all $n$?",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [
    "question"
  ],
  "collection": "erdos",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "Erdos456.erdos_456.parts.i",
  "statement_lean": "theorem erdos_456.parts.i :\n    Tendsto (fun N ↦ (count (fun n ↦ m n < p n) N : ℝ) / (N : ℝ)) atTop (𝓝 1)",
  "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 456\n\n*References:*\n- [erdosproblems.com/456](https://www.erdosproblems.com/456)\n- [Er79e] Erdős, Paul, Some unconventional problems in number theory. Astérisque (1979), 73--82.\n-/\n\n@[expose] public section\n\nopen Nat Filter\nopen scoped Topology Asymptotics\n\nnamespace Erdos456\n\n/--\nLet $p_n$ be the smallest prime $\\equiv 1\\pmod{n}$.\n-/\nnoncomputable def p (n : ℕ) : ℕ :=\n  sInf { k | k.Prime ∧ k ≡ 1 [MOD n] }\n\n/--\nLet $m_n$ be the smallest integer such that $n\\mid \\phi(m_n)$.\n-/\nnoncomputable def m (n : ℕ) : ℕ :=\n  sInf { k | 0 < k ∧ n ∣ totient k }\n\nopen scoped Classical in\n/--\nIs it true that $m_n<p_n$ for almost all $n$?\n-/\n@[category research open, question, AMS 11]\ntheorem erdos_456.parts.i :\n    Tendsto (fun N ↦ (count (fun n ↦ m n < p n) N : ℝ) / (N : ℝ)) atTop (𝓝 1) := by\n  sorry\n\nopen scoped Classical in\n/--\nDoes $p_n/m_n \\to \\infty$ for almost all $n$?\n-/\n@[category research open, question, AMS 11]\ntheorem erdos_456.parts.ii :\n    ∃ A : Set ℕ, Tendsto (fun N ↦ (count (· ∈ A) N : ℝ) / (N : ℝ)) atTop (𝓝 1) ∧\n      Tendsto (fun n ↦ (p n : ℝ) / (m n : ℝ)) (atTop ⊓ 𝓟 A) atTop := by\n  sorry\n\n/--\nAre there infinitely many primes $p$ such that $p-1$ is the only $n$ for which $m_n=p$?\n-/\n@[category research open, question, AMS 11]\ntheorem erdos_456.parts.iii :\n    { q | q.Prime ∧ ∀ n, m n = q ↔ n = q - 1 }.Infinite := by\n  sorry\n\n/--\nLinnik's theorem implies that $p_n\\leq n^{O(1)}$.\n-/\n@[category research solved, AMS 11]\ntheorem erdos_456.variants.linniks_theorem :\n    ∃ L : ℝ, (fun n ↦ (p n : ℝ)) =O[atTop] (fun n ↦ (n : ℝ) ^ L) := by\n  sorry\n\n/--\nIt is trivial that $m_n \\leq p_n$ always.\n-/\n@[category textbook, AMS 11]\ntheorem erdos_456.variants.mn_leq_pn (n : ℕ) :\n    m n ≤ p n := by\n  unfold m p\n  rcases eq_or_ne n 0 with hn | hn\n  · subst hn\n    have hempty : {k | 0 < k ∧ (0 : ℕ) ∣ totient k} = (∅ : Set ℕ) := by\n      ext k\n      simp only [Set.mem_ofPred_eq, Set.mem_empty_iff_false, iff_false, not_and]\n      intro hk\n      rw [zero_dvd_iff]\n      have := Nat.totient_pos.mpr hk\n      omega\n    rw [hempty, Nat.sInf_empty]\n    exact Nat.zero_le _\n  · have hne : {k | k.Prime ∧ k ≡ 1 [MOD n]}.Nonempty := by\n      obtain ⟨q, _, hq, hmod⟩ :=\n        Nat.forall_exists_prime_gt_and_modEq 0 hn (Nat.coprime_one_left n)\n      exact ⟨q, hq, hmod⟩\n    obtain ⟨hp, hmod⟩ := Nat.sInf_mem hne\n    apply Nat.sInf_le\n    refine ⟨hp.pos, ?_⟩\n    rw [Nat.totient_prime hp]\n    exact (Nat.modEq_iff_dvd' hp.pos).mp hmod.symm\n\n/--\nErdős [Er79e] writes it is 'easy to show' that for infinitely many $n$ we have $m_n < p_n$.\n-/\n@[category research solved, AMS 11]\ntheorem erdos_456.variants.infinitely_many_n :\n    { n | m n < p n }.Infinite := by\n  apply Set.infinite_of_injective_forall_mem (f := fun j : ℕ ↦ 2 ^ (2 * j + 3))\n  · intro a b hab\n    apply Nat.pow_right_injective (by decide) at hab\n    omega\n  · intro j\n    let k := 2 * j + 3\n    -- Witness n = 2^k for odd k ≥ 3; then m(n) ≤ 2n, while 3 ∣ n + 1 forces p(n) > 2n.\n    change m (2 ^ k) < p (2 ^ k)\n    have hm : m (2 ^ k) ≤ 2 ^ (k + 1) := by\n      unfold m\n      refine Nat.sInf_le ⟨by positivity, ?_⟩\n      rw [Nat.totient_prime_pow Nat.prime_two (by omega)]\n      norm_num\n    have hp : 2 ^ (k + 1) + 1 ≤ p (2 ^ k) := by\n      unfold p\n      let q := sInf {x | x.Prime ∧ x ≡ 1 [MOD 2 ^ k]}\n      change 2 ^ (k + 1) + 1 ≤ q\n      have hne : {x | x.Prime ∧ x ≡ 1 [MOD 2 ^ k]}.Nonempty := by\n        obtain ⟨r, _, hr, hmod⟩ := Nat.forall_exists_prime_gt_and_modEq 0\n          (pow_ne_zero k (by decide)) (Nat.coprime_one_left (2 ^ k))\n        exact ⟨r, hr, hmod⟩\n      obtain ⟨hprime, hmod⟩ : q.Prime ∧ q ≡ 1 [MOD 2 ^ k] := Nat.sInf_mem hne\n      rw [Nat.pow_succ]\n      by_contra hbound\n      have hxle : q ≤ 2 ^ k * 2 := by omega\n      have hlower : 2 ^ k + 1 ≤ q := by\n        simpa [add_comm] using hmod.symm.add_le_of_lt hprime.one_lt\n      have hupper : q ≤ 2 ^ k + 1 :=\n        (hmod.trans Nat.add_modEq_left.symm).le_of_lt_add (by omega)\n      have hxeq : q = 2 ^ k + 1 := by omega\n      have hkodd : Odd k := ⟨j + 1, by dsimp [k]; omega⟩\n      have hxeqthree : q = 3 := (hprime.dvd_iff_eq (by decide)).mp (by\n        rw [hxeq]\n        simpa using hkodd.nat_add_dvd_pow_add_pow 2 1)\n      have heighteen : 8 ≤ 2 ^ k := by\n        change 2 ^ 3 ≤ 2 ^ k\n        exact Nat.pow_le_pow_right (by decide) (by dsimp [k]; omega)\n      omega\n    omega\n\nopen scoped Classical in\n/--\nErdős [Er79e] writes it is 'easy to show' that $m_n/n \\to \\infty$ for almost all $n$.\n-/\n@[category research solved, AMS 11]\ntheorem erdos_456.variants.m_div_n :\n    ∃ A : Set ℕ, Tendsto (fun N ↦ (count (· ∈ A) N : ℝ) / N) atTop (𝓝 1) ∧\n      Tendsto (fun n ↦ (m n : ℝ) / (n : ℝ)) (atTop ⊓ 𝓟 A) atTop := by\n  sorry\n\nend Erdos456\n",
  "statement_hash": "2fb55ca466cab14893045a581f72171b51de8c84e71f0687d972d37778c805f8",
  "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."
}