/- Copyright 2025 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. -/ import FormalConjecturesUtil namespace Mersennenamespace Nat

A Wagstaff prime is a prime number of the form $(2^p+1)/3$.

def GivesWagstaffPrime (p : ) : Prop := Odd p Nat.Prime ((2^p + 1) / 3)

Holds when there is exists a number k such that $p = 2^k \pm 1$ or $p = 4^k \pm 3$.

def IsSpecialForm (p : ) : Prop := k : , p = 2^k + 1 p = 2^k - 1 p = 4^k + 3 p = 4^k - 3end Natopen Mersenne

The Catalan-Mersenne numbers, defined recursively by $c_0 = 2$ and $c_{n+1} = 2^{c_n} - 1$.

def catalanMersenne : | 0 => 2 | n + 1 => 2 ^ catalanMersenne n - 1

A natural number p satisfies the statement of the New Mersenne Conjecture if whenever two of the following conditions hold, then all three must hold:

    $2^p-1$ is prime

    $(2^p+1)/3$ is prime

    Exists a number k such that $p = 2^k \pm 1$ or $p = 4^k \pm 3$

def NewMersenneConjectureStatement (p : ) : Prop := ((mersenne p).Prime p.GivesWagstaffPrime p.IsSpecialForm) ((mersenne p).Prime p.IsSpecialForm p.GivesWagstaffPrime) (p.GivesWagstaffPrime p.IsSpecialForm (mersenne p).Prime)

For any odd natural number p if two of the following conditions hold, then all three must hold:

    $2^p-1$ is prime

    $(2^p+1)/3$ is prime

    Exists a number k such that $p = 2^k \pm 1$ or $p = 4^k \pm 3$

@[category research open, AMS 11] theorem new_mersenne_conjecture (p : ) (hp : Odd p) : NewMersenneConjectureStatement p := p:hp:Odd pNewMersenneConjectureStatement p All goals completed! 🐙

It suffices to check this conjecture for primes

H: (p : ), Nat.Prime p NewMersenneConjectureStatement pp:hp_odd:Odd php_prime:¬Nat.Prime pleft✝:Odd phP:Nat.Prime ((2 ^ p + 1) / 3)hp1:¬p = 1q: := p.minFachq_ne2:q 2hq_odd:Odd qs:hs:p = q * shs_odd:Odd sh3q:3 2 ^ q + 1h3p:3 2 ^ p + 1k:hk:2 ^ p + 1 = (2 ^ q + 1) * kd: := (2 ^ q + 1) / 3hd:d = (2 ^ q + 1) / 3hd_dvd:d (2 ^ p + 1) / 3h8:8 2 ^ qhd_lt:d < (2 ^ p + 1) / 3False H: (p : ), Nat.Prime p NewMersenneConjectureStatement pp:hp_odd:Odd php_prime:¬Nat.Prime pleft✝:Odd phP:Nat.Prime ((2 ^ p + 1) / 3)hp1:¬p = 1q: := p.minFachq_ne2:q 2hq_odd:Odd qs:hs:p = q * shs_odd:Odd sh3q:3 2 ^ q + 1h3p:3 2 ^ p + 1k:hk:2 ^ p + 1 = (2 ^ q + 1) * kd: := (2 ^ q + 1) / 3hd:d = (2 ^ q + 1) / 3hd_dvd:d (2 ^ p + 1) / 3h8:8 2 ^ qhd_lt:d < (2 ^ p + 1) / 3h:d = 1FalseH: (p : ), Nat.Prime p NewMersenneConjectureStatement pp:hp_odd:Odd php_prime:¬Nat.Prime pleft✝:Odd phP:Nat.Prime ((2 ^ p + 1) / 3)hp1:¬p = 1q: := p.minFachq_ne2:q 2hq_odd:Odd qs:hs:p = q * shs_odd:Odd sh3q:3 2 ^ q + 1h3p:3 2 ^ p + 1k:hk:2 ^ p + 1 = (2 ^ q + 1) * kd: := (2 ^ q + 1) / 3hd:d = (2 ^ q + 1) / 3hd_dvd:d (2 ^ p + 1) / 3h8:8 2 ^ qhd_lt:d < (2 ^ p + 1) / 3h:d = (2 ^ p + 1) / 3False H: (p : ), Nat.Prime p NewMersenneConjectureStatement pp:hp_odd:Odd php_prime:¬Nat.Prime pleft✝:Odd phP:Nat.Prime ((2 ^ p + 1) / 3)hp1:¬p = 1q: := p.minFachq_ne2:q 2hq_odd:Odd qs:hs:p = q * shs_odd:Odd sh3q:3 2 ^ q + 1h3p:3 2 ^ p + 1k:hk:2 ^ p + 1 = (2 ^ q + 1) * kd: := (2 ^ q + 1) / 3hd:d = (2 ^ q + 1) / 3hd_dvd:d (2 ^ p + 1) / 3h8:8 2 ^ qhd_lt:d < (2 ^ p + 1) / 3h:d = 1FalseH: (p : ), Nat.Prime p NewMersenneConjectureStatement pp:hp_odd:Odd php_prime:¬Nat.Prime pleft✝:Odd phP:Nat.Prime ((2 ^ p + 1) / 3)hp1:¬p = 1q: := p.minFachq_ne2:q 2hq_odd:Odd qs:hs:p = q * shs_odd:Odd sh3q:3 2 ^ q + 1h3p:3 2 ^ p + 1k:hk:2 ^ p + 1 = (2 ^ q + 1) * kd: := (2 ^ q + 1) / 3hd:d = (2 ^ q + 1) / 3hd_dvd:d (2 ^ p + 1) / 3h8:8 2 ^ qhd_lt:d < (2 ^ p + 1) / 3h:d = (2 ^ p + 1) / 3False All goals completed! 🐙

The New Mersenne Conjecture statement holds for odd primes.

@[category research open, AMS 11] theorem new_mersenne_conjecture.variants.prime (p : ) (hp : p.Prime) (h : Odd p) : NewMersenneConjectureStatement p := p:hp:Nat.Prime ph:Odd pNewMersenneConjectureStatement p All goals completed! 🐙

Are there infinitely many Mersenne primes?

@[category research open, AMS 11] theorem infinitely_many_mersenne_primes : answer(sorry) Set.Infinite { p : | (mersenne p).Prime } := True {p | Nat.Prime (mersenne p)}.Infinite All goals completed! 🐙

The first five Catalan-Mersenne numbers $c_0, \ldots, c_4$ are known to be prime. Catalan conjectured that they are prime "up to a certain limit". Are all Catalan-Mersenne numbers $c_n$ with $n \geq 5$ prime?

@[category research open, AMS 11] theorem catalans_mersenne_conjecture : answer(sorry) n 5, Nat.Prime (catalanMersenne n) := True n 5, Nat.Prime (catalanMersenne n) All goals completed! 🐙end Mersenne