/-
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.
-/
import FormalConjecturesUtilFactorial primes
A factorial prime is a prime that is one more or one less than a factorial. It is conjectured that there are infinitely many factorial primes.
References:
namespace FactorialPrimeA factorial prime is a prime one above or one below a factorial.
def IsFactorialPrime (p : ℕ) : Prop :=
p.Prime ∧ ∃ n : ℕ, p = n.factorial + 1 ∨ n.factorial = p + 1@[category test, AMS 11]
theorem seven_isFactorialPrime : IsFactorialPrime 7 := ⊢ IsFactorialPrime 7
refine ⟨⊢ Nat.Prime 7 All goals completed! 🐙, 3, Or.inl ?_⟩
All goals completed! 🐙@[category test, AMS 11]
theorem twentyThree_isFactorialPrime : IsFactorialPrime 23 := ⊢ IsFactorialPrime 23
refine ⟨⊢ Nat.Prime 23 All goals completed! 🐙, 4, Or.inr ?_⟩
All goals completed! 🐙There are infinitely many factorial primes.
@[category research open, AMS 11]
theorem infinitely_many_factorial_primes :
Set.Infinite {p : ℕ | IsFactorialPrime p} := ⊢ {p | IsFactorialPrime p}.Infinite
All goals completed! 🐙end FactorialPrime