{
  "id": "8186",
  "ident": "NS.08186",
  "slug": "wikipedia-mersenne",
  "title": "Conjectures about Mersenne primes",
  "status": "open",
  "statement_status": "reviewed",
  "statement_md": "For any odd natural number `p` if two of the following conditions hold,\nthen all three must hold:\n1. $2^p-1$ is prime\n2. $(2^p+1)/3$ is prime\n3. Exists a number `k` such that $p = 2^k \\\\pm 1$ or $p = 4^k \\\\pm 3$",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [],
  "collection": "wikipedia",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "Mersenne.new_mersenne_conjecture",
  "statement_lean": "theorem new_mersenne_conjecture (p : ℕ) (hp : Odd p) :\n    NewMersenneConjectureStatement p",
  "challenge_source": "/-\nCopyright 2025 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# Conjectures about Mersenne primes\n\n*References:*\n- [Wikipedia: Mersenne conjectures](https://en.wikipedia.org/wiki/Mersenne_conjectures)\n- [Wikipedia: Catalan's Mersenne conjecture](https://en.wikipedia.org/wiki/Catalan%27s_Mersenne_conjecture)\n- [Wikipedia: List of unsolved problems in mathematics](https://en.wikipedia.org/wiki/List_of_unsolved_problems_in_mathematics#Prime_numbers)\n- [Wikipedia: Wieferich prime](https://en.wikipedia.org/wiki/Wieferich_prime)\n- [MathWorld: Catalan-Mersenne Number](https://mathworld.wolfram.com/Catalan-MersenneNumber.html)\n- A. Rotkiewicz, *Sur les nombres de Mersenne dépourvus de diviseurs carrés et sur les nombres\n  naturels $n$, tels que $n^2 \\mid 2^n - 2$*, Mat. Vesnik **2** (17) (1965), 78–80.\n-/\n\n@[expose] public section\n\nnamespace Mersenne\n\nnamespace Nat\n\n/--\nA Wagstaff prime is a prime number of the form $(2^p+1)/3$.\n-/\ndef GivesWagstaffPrime (p : ℕ) : Prop :=\n  Odd p ∧ Nat.Prime ((2^p + 1) / 3)\n\n/--\nHolds when there is exists a number `k` such that $p = 2^k \\\\pm 1$ or $p = 4^k \\\\pm 3$.\n-/\ndef IsSpecialForm (p : ℕ) : Prop :=\n  ∃ k : ℕ, p = 2^k + 1 ∨ p = 2^k - 1 ∨ p = 4^k + 3 ∨ p = 4^k - 3\n\nend Nat\n\nopen Mersenne\n\n/--\nThe Catalan-Mersenne numbers, defined recursively by $c_0 = 2$ and\n$c_{n+1} = 2^{c_n} - 1$.\n-/\ndef catalanMersenne : ℕ → ℕ\n  | 0 => 2\n  | n + 1 => 2 ^ catalanMersenne n - 1\n\n/--\nA natural number `p` satisfies the statement of the New Mersenne Conjecture if whenever\ntwo of the following conditions hold,\nthen all three must hold:\n1. $2^p-1$ is prime\n2. $(2^p+1)/3$ is prime\n3. Exists a number `k` such that $p = 2^k \\\\pm 1$ or $p = 4^k \\\\pm 3$\n-/\ndef NewMersenneConjectureStatement (p : ℕ) : Prop :=\n  ((mersenne p).Prime ∧ p.GivesWagstaffPrime → p.IsSpecialForm) ∧\n  ((mersenne p).Prime ∧ p.IsSpecialForm → p.GivesWagstaffPrime) ∧\n  (p.GivesWagstaffPrime ∧ p.IsSpecialForm → (mersenne p).Prime)\n\n/--\nFor any odd natural number `p` if two of the following conditions hold,\nthen all three must hold:\n1. $2^p-1$ is prime\n2. $(2^p+1)/3$ is prime\n3. Exists a number `k` such that $p = 2^k \\\\pm 1$ or $p = 4^k \\\\pm 3$\n-/\n@[category research open, AMS 11]\ntheorem new_mersenne_conjecture (p : ℕ) (hp : Odd p) :\n    NewMersenneConjectureStatement p := by\n  sorry\n\n/-- It suffices to check this conjecture for odd primes. The statement fails at `p = 2`:\n`mersenne 2 = 3` is prime and `2 = 2 ^ 0 + 1`, but `2` gives no Wagstaff prime. -/\n@[category textbook, AMS 11]\ntheorem new_mersenne_conjecture_of_prime :\n    (∀ p, p.Prime → Odd p → NewMersenneConjectureStatement p) →\n    ∀ p, Odd p → NewMersenneConjectureStatement p := by\n  intro H p hp_odd\n  by_cases hp_prime : p.Prime\n  · exact H p hp_prime hp_odd\n  suffices ¬Nat.GivesWagstaffPrime p by\n    have hF1 : ¬(mersenne p).Prime := fun h => hp_prime h.of_mersenne\n    refine ⟨?_, ?_, ?_⟩ <;> grind\n  rintro ⟨_, hP⟩\n  by_cases hp1 : p = 1\n  · grind\n  set q := p.minFac\n  have hq_dvd : q ∣ p := Nat.minFac_dvd p\n  have hq_ne2 : q ≠ 2 := fun h =>\n    Nat.not_even_iff_odd.mpr hp_odd (even_iff_two_dvd.mpr (h ▸ hq_dvd))\n  have hq_odd : Odd q := (Nat.minFac_prime hp1).odd_of_ne_two hq_ne2\n  obtain ⟨s, hs⟩ := hq_dvd\n  have hs_odd : Odd s := (Nat.odd_mul.mp (hs ▸ hp_odd)).2\n  have hpow_dvd : 2 ^ q + 1 ∣ 2 ^ p + 1 := by\n    grind [one_pow, ← pow_mul, Odd.nat_add_dvd_pow_add_pow (x := 2 ^ q) (y := 1) hs_odd]\n  have h3q : 3 ∣ 2 ^ q + 1 := by\n    grind [Odd.nat_add_dvd_pow_add_pow (x := 2) (y := 1)]\n  have h3p : 3 ∣ 2 ^ p + 1 := h3q.trans hpow_dvd\n  obtain ⟨k, hk⟩ := hpow_dvd\n  set d := (2 ^ q + 1) / 3 with hd\n  have hd_dvd : d ∣ (2 ^ p + 1) / 3 := by\n    use k\n    grind [mul_comm, Nat.mul_div_assoc, mul_comm]\n  have h8 : 8 ≤ 2 ^ q := by\n    calc 8 = 2 ^ 3 := by norm_num\n      _ ≤ 2 ^ q := Nat.pow_le_pow_right (by norm_num) (by grind [(Nat.minFac_prime hp1).two_le])\n  have hd_lt : d < (2 ^ p + 1) / 3 := by\n    have hpow : 2 ^ q < 2 ^ p := by\n      apply Nat.pow_lt_pow_right <;> grind [Nat.not_prime_iff_minFac_lt]\n    grind [Nat.mul_div_cancel_left]\n  rcases hP.eq_one_or_self_of_dvd d hd_dvd with h | h <;> grind\n\n/-- The New Mersenne Conjecture statement holds for odd primes. -/\n@[category research open, AMS 11]\ntheorem new_mersenne_conjecture.variants.prime (p : ℕ) (hp : p.Prime) (h : Odd p) :\n    NewMersenneConjectureStatement p := by\n  sorry\n\n/--\nAre there infinitely many Mersenne primes?\n-/\n@[category research open, question, AMS 11]\ntheorem infinitely_many_mersenne_primes :\n  Set.Infinite { p : ℕ | (mersenne p).Prime } := by\n    sorry\n\n/--\nThe first five Catalan-Mersenne numbers $c_0, \\ldots, c_4$ are known to be prime.\nCatalan conjectured that they are prime \"up to a certain limit\".\nAre all Catalan-Mersenne numbers $c_n$ with $n \\geq 5$ prime?\n-/\n@[category research open, question, AMS 11]\ntheorem catalans_mersenne_conjecture :\n    ∀ n ≥ 5, Nat.Prime (catalanMersenne n) := by\n  sorry\n\n/-- Checks `Squarefree (mersenne p)` at $p = 2, 3$ and at the first composite prime-exponent value\n$M_{11} = 2047 = 23 \\cdot 89$. -/\n@[category test, AMS 11]\ntheorem squarefree_mersenne_small_primes :\n    Squarefree (mersenne 2) ∧ Squarefree (mersenne 3) ∧ Squarefree (mersenne 11) := by\n  decide +kernel\n\n/-- Confirms that $M_0 = 0$ and $M_6 = 63 = 3^2 \\cdot 7$ fail `Squarefree`, motivating the\nrestriction to prime exponents. -/\n@[category test, AMS 11]\ntheorem not_squarefree_mersenne_zero_and_six :\n    ¬ Squarefree (mersenne 0) ∧ ¬ Squarefree (mersenne 6) := by\n  refine ⟨by rw [mersenne_zero]; exact not_squarefree_zero, fun h => ?_⟩\n  have h3 : IsUnit (3 : ℕ) := h 3 ⟨7, rfl⟩\n  rw [Nat.isUnit_iff] at h3\n  omega\n\n/-- At composite exponent $q = 6$, $3^2 \\mid M_6 = 63$ even though $3$ is not a Wieferich prime. -/\n@[category test, AMS 11]\ntheorem composite_index_sq_dvd_not_wieferich :\n    3 ^ 2 ∣ mersenne 6 ∧ ¬ IsWieferichPrime 3 :=\n  ⟨⟨7, rfl⟩, by decide⟩\n\n/--\nIs $M_p = 2^p - 1$ squarefree for every prime $p$?\n-/\n@[category research open, question, AMS 11]\ntheorem squarefree_mersenne_of_prime :\n    ∀ p : ℕ, p.Prime → Squarefree (mersenne p) := by\n  sorry\n\n/--\nFor primes $q$ and $p$ with $p \\mid M_q$, the square $p^2$ divides $M_q = 2^q - 1$ precisely when\n`IsWieferichPrime p` holds. The unsolved-problems source states the forward direction from\n$p^2 \\mid M_q$ to `IsWieferichPrime p`; the converse under $p \\mid M_q$ is added here.\n-/\n@[category textbook, AMS 11]\ntheorem sq_dvd_mersenne_iff_isWieferichPrime\n    {q p : ℕ} (hq : q.Prime) (hp : p.Prime) (hdvd : p ∣ mersenne q) :\n    p ^ 2 ∣ mersenne q ↔ IsWieferichPrime p := by\n  sorry\n\n/--\nRotkiewicz's theorem (1965): if infinitely many values $M_n = 2^n - 1$ are squarefree, then\ninfinitely many primes fail `IsWieferichPrime`. Allowing $n$ to range over all natural numbers\nrather than only primes gives the stronger form of this implication.\n-/\n@[category research solved, AMS 11]\ntheorem rotkiewicz_infinite_non_wieferich_of_squarefree_mersenne :\n    {n : ℕ | Squarefree (mersenne n)}.Infinite →\n      {p : ℕ | p.Prime ∧ ¬ IsWieferichPrime p}.Infinite := by\n  sorry\n\nend Mersenne\n",
  "statement_hash": "75595da81fdef035a870a173b2581ed07e246871e952567a41d80439466d0236",
  "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."
}