/-
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 FormalConjectures.Wikipedia.Euclid
public import FormalConjecturesUtilInfinitude of primorial primes
For $n \in \mathbb{N}$, let $p_n#$ (Nat.kthPrimorial n) denote the primorial multiplying the
initial $n$ primes (with $p_0# = 1$), so EuclidNumbers.Euclid n equals $p_n# + 1$ and
$p_n# - 1$ is a Kummer number (OEIS A057588). Primes equal to $p_n# + 1$ (prime Euclid
numbers, OEIS A018239) or $p_n# - 1$ (prime Kummer numbers, OEIS A057705) are called
primorial primes (OEIS A228486, studied computationally by Dubner 1987). Although $p_n# + 1$
always has a prime factor exceeding $p_n$, the integers $p_n# \pm 1$ are often composite
(beginning with $p_4# - 1 = 209 = 11 \times 19$ and $p_6# + 1 = 30031 = 59 \times 509$). Whether
infinitely many primorial primes exist, whether infinitely many Kummer numbers are prime, and
whether infinitely many integers $p_n# \pm 1$ (or of either sign individually) are composite all
remain open.
References:
H. Dubner, Factorial and primorial primes, J. Recreational Math. 19 (1987), no. 3, 197–203.
@[expose] public sectionnamespace PrimorialPrime
EuclidNumbers.Euclid n agrees with Nat.kthPrimorial n + 1.
@[simp, category API, AMS 11]
theorem euclid_eq_kthPrimorial_add_one (n : ℕ) :
EuclidNumbers.Euclid n = Nat.kthPrimorial n + 1 :=
Nat.add_comm 1 _
A prime Euclid number, i.e., a prime equal to EuclidNumbers.Euclid n ($p_n# + 1$) for some
$n \in \mathbb{N}$ (including $E_0 = p_0# + 1 = 2$).
def IsEuclidPrimorialPrime (q : ℕ) : Prop :=
q.Prime ∧ ∃ n : ℕ, q = EuclidNumbers.Euclid nA prime Kummer number, i.e., a prime equal to $p_n# - 1$ for some $n \in \mathbb{N}$.
def IsKummerPrimorialPrime (q : ℕ) : Prop :=
q.Prime ∧ ∃ n : ℕ, q + 1 = Nat.kthPrimorial nA prime equal to $p_n# \pm 1$ for some $n \in \mathbb{N}$.
def IsPrimorialPrime (q : ℕ) : Prop :=
IsEuclidPrimorialPrime q ∨ IsKummerPrimorialPrime qVerifies $2 = p_0# + 1$, $3 = p_1# + 1$, and $31 = p_3# + 1$ as prime Euclid numbers, and $5 = p_2# - 1$ and $29 = p_3# - 1$ as prime Kummer numbers.
@[category test, AMS 11]
theorem primorialPrime_small_witnesses :
IsEuclidPrimorialPrime 2 ∧ IsEuclidPrimorialPrime 3 ∧ IsEuclidPrimorialPrime 31 ∧
IsKummerPrimorialPrime 5 ∧ IsPrimorialPrime 29 := ⊢ IsEuclidPrimorialPrime 2 ∧
IsEuclidPrimorialPrime 3 ∧ IsEuclidPrimorialPrime 31 ∧ IsKummerPrimorialPrime 5 ∧ IsPrimorialPrime 29
refine ⟨⟨⊢ Nat.Prime 2 All goals completed! 🐙, 0, ⊢ 2 = EuclidNumbers.Euclid 0 All goals completed! 🐙⟩, ⟨⊢ Nat.Prime 3 All goals completed! 🐙, 1, ⊢ 3 = EuclidNumbers.Euclid 1 All goals completed! 🐙⟩, ⟨⊢ Nat.Prime 31 All goals completed! 🐙, 3, ⊢ 31 = EuclidNumbers.Euclid 3 All goals completed! 🐙⟩,
⟨⊢ Nat.Prime 5 All goals completed! 🐙, 2, ⊢ 5 + 1 = Nat.kthPrimorial 2 All goals completed! 🐙⟩, Or.inr ⟨⊢ Nat.Prime 29 All goals completed! 🐙, 3, ⊢ 29 + 1 = Nat.kthPrimorial 3 All goals completed! 🐙⟩⟩Checks that $p_4# - 1 = 209 = 11 \times 19$ and $E_6 = p_6# + 1 = 30031 = 59 \times 509$ are composite, hence not primorial primes.
h4:Nat.kthPrimorial 4 = 210h6:Nat.kthPrimorial 6 = 30030⊢ ¬IsPrimorialPrime (210 - 1) ∧ ¬Nat.Prime (30030 + 1)
refine ⟨?_, by h4:Nat.kthPrimorial 4 = 210h6:Nat.kthPrimorial 6 = 30030⊢ ¬Nat.Prime (30030 + 1) norm_num All goals completed! 🐙⟩
rintro (⟨hp, _⟩ | ⟨hp, _⟩) inl h4:Nat.kthPrimorial 4 = 210h6:Nat.kthPrimorial 6 = 30030hp:Nat.Prime (210 - 1)right✝:∃ n, 210 - 1 = EuclidNumbers.Euclid n⊢ Falseinr h4:Nat.kthPrimorial 4 = 210h6:Nat.kthPrimorial 6 = 30030hp:Nat.Prime (210 - 1)right✝:∃ n, 210 - 1 + 1 = n.kthPrimorial⊢ False <;> inl h4:Nat.kthPrimorial 4 = 210h6:Nat.kthPrimorial 6 = 30030hp:Nat.Prime (210 - 1)right✝:∃ n, 210 - 1 = EuclidNumbers.Euclid n⊢ Falseinr h4:Nat.kthPrimorial 4 = 210h6:Nat.kthPrimorial 6 = 30030hp:Nat.Prime (210 - 1)right✝:∃ n, 210 - 1 + 1 = n.kthPrimorial⊢ False norm_num at hp All goals completed! 🐙
Every primorial prime is prime, and infinitude of either prime Euclid numbers
(EuclidNumbers.infinite_prime_euclid_numbers) or prime Kummer numbers implies infinitude of
IsPrimorialPrime.
@[category API, AMS 11]
theorem isPrimorialPrime_prime_and_infinite_imp :
(∀ q : ℕ, IsPrimorialPrime q → q.Prime) ∧
(type_of% EuclidNumbers.infinite_prime_euclid_numbers →
{q : ℕ | IsPrimorialPrime q}.Infinite) ∧
({q : ℕ | IsKummerPrimorialPrime q}.Infinite → {q : ℕ | IsPrimorialPrime q}.Infinite) := by ⊢ (∀ (q : ℕ), IsPrimorialPrime q → Nat.Prime q) ∧
({n | Nat.Prime (EuclidNumbers.Euclid n)}.Infinite → {q | IsPrimorialPrime q}.Infinite) ∧
({q | IsKummerPrimorialPrime q}.Infinite → {q | IsPrimorialPrime q}.Infinite)
have hmono : StrictMono EuclidNumbers.Euclid := by
refine strictMono_nat_of_lt_succ fun k => ?_ k:ℕ⊢ EuclidNumbers.Euclid k < EuclidNumbers.Euclid (k + 1) hmono:StrictMono EuclidNumbers.Euclid⊢ (∀ (q : ℕ), IsPrimorialPrime q → Nat.Prime q) ∧
({n | Nat.Prime (EuclidNumbers.Euclid n)}.Infinite → {q | IsPrimorialPrime q}.Infinite) ∧
({q | IsKummerPrimorialPrime q}.Infinite → {q | IsPrimorialPrime q}.Infinite)
have hpos : 0 < Nat.kthPrimorial k :=
Finset.prod_pos fun i _ => (Nat.prime_nth_prime i).pos k:ℕhpos:0 < k.kthPrimorial⊢ EuclidNumbers.Euclid k < EuclidNumbers.Euclid (k + 1) hmono:StrictMono EuclidNumbers.Euclid⊢ (∀ (q : ℕ), IsPrimorialPrime q → Nat.Prime q) ∧
({n | Nat.Prime (EuclidNumbers.Euclid n)}.Infinite → {q | IsPrimorialPrime q}.Infinite) ∧
({q | IsKummerPrimorialPrime q}.Infinite → {q | IsPrimorialPrime q}.Infinite)
have hp2 : 2 ≤ Nat.nth Nat.Prime k := (Nat.prime_nth_prime k).two_le k:ℕhpos:0 < k.kthPrimorialhp2:2 ≤ Nat.nth Nat.Prime k⊢ EuclidNumbers.Euclid k < EuclidNumbers.Euclid (k + 1) hmono:StrictMono EuclidNumbers.Euclid⊢ (∀ (q : ℕ), IsPrimorialPrime q → Nat.Prime q) ∧
({n | Nat.Prime (EuclidNumbers.Euclid n)}.Infinite → {q | IsPrimorialPrime q}.Infinite) ∧
({q | IsKummerPrimorialPrime q}.Infinite → {q | IsPrimorialPrime q}.Infinite)
rw [euclid_eq_kthPrimorial_add_one, k:ℕhpos:0 < k.kthPrimorialhp2:2 ≤ Nat.nth Nat.Prime k⊢ k.kthPrimorial + 1 < EuclidNumbers.Euclid (k + 1) k:ℕhpos:0 < k.kthPrimorialhp2:2 ≤ Nat.nth Nat.Prime k⊢ k.kthPrimorial + 1 < k.kthPrimorial * Nat.nth Nat.Prime k + 1 hmono:StrictMono EuclidNumbers.Euclid⊢ (∀ (q : ℕ), IsPrimorialPrime q → Nat.Prime q) ∧
({n | Nat.Prime (EuclidNumbers.Euclid n)}.Infinite → {q | IsPrimorialPrime q}.Infinite) ∧
({q | IsKummerPrimorialPrime q}.Infinite → {q | IsPrimorialPrime q}.Infinite) euclid_eq_kthPrimorial_add_one, k:ℕhpos:0 < k.kthPrimorialhp2:2 ≤ Nat.nth Nat.Prime k⊢ k.kthPrimorial + 1 < (k + 1).kthPrimorial + 1 k:ℕhpos:0 < k.kthPrimorialhp2:2 ≤ Nat.nth Nat.Prime k⊢ k.kthPrimorial + 1 < k.kthPrimorial * Nat.nth Nat.Prime k + 1 hmono:StrictMono EuclidNumbers.Euclid⊢ (∀ (q : ℕ), IsPrimorialPrime q → Nat.Prime q) ∧
({n | Nat.Prime (EuclidNumbers.Euclid n)}.Infinite → {q | IsPrimorialPrime q}.Infinite) ∧
({q | IsKummerPrimorialPrime q}.Infinite → {q | IsPrimorialPrime q}.Infinite) Nat.kthPrimorial_succ k:ℕhpos:0 < k.kthPrimorialhp2:2 ≤ Nat.nth Nat.Prime k⊢ k.kthPrimorial + 1 < k.kthPrimorial * Nat.nth Nat.Prime k + 1 k:ℕhpos:0 < k.kthPrimorialhp2:2 ≤ Nat.nth Nat.Prime k⊢ k.kthPrimorial + 1 < k.kthPrimorial * Nat.nth Nat.Prime k + 1 hmono:StrictMono EuclidNumbers.Euclid⊢ (∀ (q : ℕ), IsPrimorialPrime q → Nat.Prime q) ∧
({n | Nat.Prime (EuclidNumbers.Euclid n)}.Infinite → {q | IsPrimorialPrime q}.Infinite) ∧
({q | IsKummerPrimorialPrime q}.Infinite → {q | IsPrimorialPrime q}.Infinite)] k:ℕhpos:0 < k.kthPrimorialhp2:2 ≤ Nat.nth Nat.Prime k⊢ k.kthPrimorial + 1 < k.kthPrimorial * Nat.nth Nat.Prime k + 1 hmono:StrictMono EuclidNumbers.Euclid⊢ (∀ (q : ℕ), IsPrimorialPrime q → Nat.Prime q) ∧
({n | Nat.Prime (EuclidNumbers.Euclid n)}.Infinite → {q | IsPrimorialPrime q}.Infinite) ∧
({q | IsKummerPrimorialPrime q}.Infinite → {q | IsPrimorialPrime q}.Infinite)
nlinarith hmono:StrictMono EuclidNumbers.Euclid⊢ (∀ (q : ℕ), IsPrimorialPrime q → Nat.Prime q) ∧
({n | Nat.Prime (EuclidNumbers.Euclid n)}.Infinite → {q | IsPrimorialPrime q}.Infinite) ∧
({q | IsKummerPrimorialPrime q}.Infinite → {q | IsPrimorialPrime q}.Infinite) hmono:StrictMono EuclidNumbers.Euclid⊢ (∀ (q : ℕ), IsPrimorialPrime q → Nat.Prime q) ∧
({n | Nat.Prime (EuclidNumbers.Euclid n)}.Infinite → {q | IsPrimorialPrime q}.Infinite) ∧
({q | IsKummerPrimorialPrime q}.Infinite → {q | IsPrimorialPrime q}.Infinite)
refine ⟨?_, fun h => (h.image hmono.injective.injOn).mono ?_,
fun h => h.mono fun _ hq => Or.inr hq⟩ refine_1 hmono:StrictMono EuclidNumbers.Euclid⊢ ∀ (q : ℕ), IsPrimorialPrime q → Nat.Prime qrefine_2 hmono:StrictMono EuclidNumbers.Euclidh:{n | Nat.Prime (EuclidNumbers.Euclid n)}.Infinite⊢ EuclidNumbers.Euclid '' {n | Nat.Prime (EuclidNumbers.Euclid n)} ⊆ {q | IsPrimorialPrime q}
· refine_1 hmono:StrictMono EuclidNumbers.Euclid⊢ ∀ (q : ℕ), IsPrimorialPrime q → Nat.Prime q rintro q (⟨hq, _⟩ | ⟨hq, _⟩) refine_1.inl hmono:StrictMono EuclidNumbers.Euclidq:ℕhq:Nat.Prime qright✝:∃ n, q = EuclidNumbers.Euclid n⊢ Nat.Prime qrefine_1.inr hmono:StrictMono EuclidNumbers.Euclidq:ℕhq:Nat.Prime qright✝:∃ n, q + 1 = n.kthPrimorial⊢ Nat.Prime q <;> refine_1.inl hmono:StrictMono EuclidNumbers.Euclidq:ℕhq:Nat.Prime qright✝:∃ n, q = EuclidNumbers.Euclid n⊢ Nat.Prime qrefine_1.inr hmono:StrictMono EuclidNumbers.Euclidq:ℕhq:Nat.Prime qright✝:∃ n, q + 1 = n.kthPrimorial⊢ Nat.Prime q exact hq All goals completed! 🐙
· refine_2 hmono:StrictMono EuclidNumbers.Euclidh:{n | Nat.Prime (EuclidNumbers.Euclid n)}.Infinite⊢ EuclidNumbers.Euclid '' {n | Nat.Prime (EuclidNumbers.Euclid n)} ⊆ {q | IsPrimorialPrime q} rintro q ⟨n, hn, rfl⟩ refine_2 hmono:StrictMono EuclidNumbers.Euclidh:{n | Nat.Prime (EuclidNumbers.Euclid n)}.Infiniten:ℕhn:n ∈ {n | Nat.Prime (EuclidNumbers.Euclid n)}⊢ EuclidNumbers.Euclid n ∈ {q | IsPrimorialPrime q}
exact Or.inl ⟨hn, n, rfl⟩ All goals completed! 🐙Verifies $7 = p_2# + 1$ and $211 = p_4# + 1$ as prime Euclid numbers, and $2309 = p_5# - 1$ as a prime Kummer number.
@[category test, AMS 11]
theorem primorialPrime_7_211_2309 :
IsEuclidPrimorialPrime 7 ∧ IsEuclidPrimorialPrime 211 ∧ IsKummerPrimorialPrime 2309 := by ⊢ IsEuclidPrimorialPrime 7 ∧ IsEuclidPrimorialPrime 211 ∧ IsKummerPrimorialPrime 2309
refine ⟨⟨by ⊢ Nat.Prime 7 decide All goals completed! 🐙, 2, by ⊢ 7 = EuclidNumbers.Euclid 2 simp All goals completed! 🐙⟩, ⟨by ⊢ Nat.Prime 211 norm_num All goals completed! 🐙, 4, by ⊢ 211 = EuclidNumbers.Euclid 4 simp All goals completed! 🐙⟩, ⟨by ⊢ Nat.Prime 2309 norm_num All goals completed! 🐙, 5, by ⊢ 2309 + 1 = Nat.kthPrimorial 5 simp All goals completed! 🐙⟩⟩
Do infinitely many primorial primes $p_n# \pm 1$ exist? (The positive-sign case $p_n# + 1$
appears as EuclidNumbers.infinite_prime_euclid_numbers.)
@[category research open, question, AMS 11]
theorem infinitely_many_primorial_primes :
{q : ℕ | IsPrimorialPrime q}.Infinite := by ⊢ {q | IsPrimorialPrime q}.Infinite
sorry All goals completed! 🐙Do infinitely many prime Kummer numbers $p_n# - 1$ exist?
@[category research open, question, AMS 11]
theorem infinitely_many_primorial_primes.variants.kummer :
{q : ℕ | IsKummerPrimorialPrime q}.Infinite := by ⊢ {q | IsKummerPrimorialPrime q}.Infinite
sorry All goals completed! 🐙Are infinitely many integers of the form $p_n# \pm 1$ composite? This statement takes the union over both signs ($m = p_n# + 1$ or $m = p_n# - 1$).
@[category research open, question, AMS 11]
theorem infinitely_many_primorial_primes.variants.composite :
{m : ℕ | m.Composite ∧
∃ n : ℕ, m = EuclidNumbers.Euclid n ∨ m + 1 = Nat.kthPrimorial n}.Infinite := by ⊢ {m | m.Composite ∧ ∃ n, m = EuclidNumbers.Euclid n ∨ m + 1 = n.kthPrimorial}.Infinite
sorry All goals completed! 🐙Are infinitely many Euclid numbers $p_n# + 1$ composite?
@[category research open, question, AMS 11]
theorem infinitely_many_primorial_primes.variants.composite_euclid :
{n : ℕ | (EuclidNumbers.Euclid n).Composite}.Infinite := by ⊢ {n | (EuclidNumbers.Euclid n).Composite}.Infinite
sorry All goals completed! 🐙Are infinitely many Kummer numbers $p_n# - 1$ composite?
@[category research open, question, AMS 11]
theorem infinitely_many_primorial_primes.variants.composite_kummer :
{m : ℕ | m.Composite ∧ ∃ n : ℕ, m + 1 = Nat.kthPrimorial n}.Infinite := by ⊢ {m | m.Composite ∧ ∃ n, m + 1 = n.kthPrimorial}.Infinite
sorry All goals completed! 🐙end PrimorialPrime