# Factorial prime

A factorial prime is a prime number that is one less or one more than a factorial (all factorials > 1 are even). The first few factorial primes are:

2 (0! + 1 or 1! + 1), 3 (2! + 1), 5 (3! − 1), 7 (3! + 1), 23 (4! − 1), 719 (6! − 1), 5039 (7! − 1), 39916801 (11! + 1), 479001599 (12! − 1), 87178291199 (14! − 1), ... (sequence A088054 in OEIS)

n! − 1 is prime for (sequence A002982 in OEIS):

n = 3, 4, 6, 7, 12, 14, 30, 32, 33, 38, 94, 166, 324, 379, 469, 546, 974, 1963, 3507, 3610, 6917, 21480, 34790, 94550, 103040, ...

n! + 1 is prime for (sequence A002981 in OEIS):

n = 0, 1, 2, 3, 11, 27, 37, 41, 73, 77, 116, 154, 320, 340, 399, 427, 872, 1477, 6380, 26951, 110059, 150209, ...

No other factorial primes are known as of May 2013.

Absence of primes to both sides of a factorial n! implies a relatively lengthy run of consecutive composite numbers, since n! ± k is divisible by k for 2 ≤ k ≤ n. For example, the next prime following 6227020777 = 13! − 23 is 6227020867 = 13! + 67 (a run of 89 consecutive composites); here the run is substantially longer than implied merely by the absence of factorial primes. Note that this is not the most efficient way to find large prime gaps. E.g., there are 95 consecutive composites between the primes 360653 and 360749.