Different Types of Prime Numbers
Beyond basic primes, mathematicians categorize prime numbers into distinct families based on special numerical properties and algebraic forms. Some families are defined by a formula, others by the spacing between primes, and others by rare properties that only a handful of known numbers satisfy.
Mersenne Primes
A Mersenne prime is a prime number that is one less than a power of two, expressed in the formula:
Mp = 2p - 1 (where p is itself a prime)
Examples of Mersenne primes include:
- 22 - 1 = 3
- 23 - 1 = 7
- 25 - 1 = 31
- 27 - 1 = 127
The requirement that the exponent be prime is necessary but not sufficient. If p is composite then 2p - 1 is always composite as well, but a prime exponent gives no guarantee. The smallest counterexample is 211 - 1 = 2047, which factors as 23 x 89.
Mersenne primes thin out sharply as the exponent grows. Among prime exponents below 1,000, roughly one in twelve produces a prime; below one million the rate has already fallen to about one in 2,400. On 24 July 2026 the Great Internet Mersenne Prime Search announced that every exponent below 141 million had been tested at least once, while only 52 Mersenne primes were known. These figures illustrate how sparse Mersenne primes become as the search range grows.
These numbers dominate the search for record primes for two reasons. The Lucas-Lehmer test, developed by Édouard Lucas in the 1870s and refined by Derrick Lehmer in 1930, decides the primality of a Mersenne number far faster than any general method. Their binary representation is also a solid string of ones, which suits computer arithmetic. The Great Internet Mersenne Prime Search, founded by George Woltman in 1996, distributes this work across volunteer machines and has found every record prime since its first record discovery in November 1996.
Mersenne primes also answer a question posed in antiquity. The Euclid-Euler theorem states that every even perfect number, meaning a number equal to the sum of its proper divisors, has the form 2p-1(2p - 1) with the second factor a Mersenne prime. The perfect numbers 6, 28, 496 and 8128 correspond to the first four Mersenne primes. Whether any odd perfect number exists remains unknown.
Prime Pairs (Twin Primes)
Twin primes (or prime pairs) are pairs of prime numbers that differ by exactly 2.
Examples of prime pairs:
- (3, 5)
- (5, 7)
- (11, 13)
- (17, 19)
- (29, 31)
- (41, 43)
The number 5 is the only prime belonging to two different twin pairs. Apart from the first pair, every twin pair surrounds a multiple of 6, since one of any three consecutive odd numbers is divisible by 3.
The famous Twin Prime Conjecture posits that there are infinitely many twin prime pairs, one of the most famous open problems in mathematics. Progress came in 2013 when Yitang Zhang proved that infinitely many prime pairs differ by no more than 70 million. Collaborative work through the Polymath project reduced that bound to 246 within a year, though closing the remaining gap to 2 has resisted every approach so far.
Viggo Brun showed in 1919 that the sum of the reciprocals of the twin primes converges to a finite value now called Brun's constant, roughly 1.9022. This contrasts with the sum of the reciprocals of all primes, which grows without limit, and it shows that twin primes are considerably rarer than primes in general even if infinitely many exist.
Other Spacings
Twin primes are one case of a broader pattern of prime constellations:
- Cousin primes: Pairs differing by 4, such as (7, 11) and (13, 17).
- Sexy primes: Pairs differing by 6, such as (5, 11) and (23, 29). The name comes from the Latin word for six.
- Prime triplets: Groups of three primes in the pattern (p, p+2, p+6) or (p, p+4, p+6), such as (11, 13, 17) and (7, 11, 13). The tighter pattern (p, p+2, p+4) occurs only once, at (3, 5, 7), because one of any such trio is always divisible by 3.
- Balanced primes: Primes equal to the average of the primes immediately before and after them, such as 5, 53 and 157.
Fermat Primes
Fermat primes take the form 22n + 1. Only five are known: 3, 5, 17, 257 and 65537. Pierre de Fermat conjectured in the seventeenth century that every number of this form is prime, but Euler factored the next case in 1732, showing that 4,294,967,297 equals 641 x 6,700,417. Every subsequent case that has been tested has proved composite, and many mathematicians now suspect the five known examples are the only ones.
These primes have a striking geometric application. The Gauss-Wantzel theorem states that a regular polygon can be constructed with compass and straightedge exactly when the number of its sides is a power of 2 multiplied by distinct Fermat primes. Gauss proved the constructibility of the 17-sided polygon on 30 March 1796, a month before his nineteenth birthday, the first advance on the problem since the Greeks. He asked for the shape to be engraved on his tombstone, though the request was never carried out.
Sophie Germain and Safe Primes
A Sophie Germain prime is a prime p such that 2p + 1 is also prime. The sequence begins 2, 3, 5, 11, 23, 29, 41 and 53. The larger partner is called a safe prime. Sophie Germain introduced these numbers while working on Fermat's Last Theorem, proving a partial result for exponents of this form. Her work on the problem belongs to the years around 1805 to 1820, and the theorem first reached print in 1823, in a footnote to a memoir by Legendre.
Safe primes matter in cryptography for a specific structural reason. If p = 2q + 1 with q prime, then the only prime factors of p - 1 are 2 and q. When q is cryptographically large, the multiplicative group modulo p has no nontrivial small subgroups apart from the subgroup of order 2. This resists the Pohlig-Hellman method, which otherwise breaks a discrete logarithm into easier ones inside small subgroups, and it is one reason safe primes are used for finite-field Diffie-Hellman key exchange. Note that Diffie-Hellman rests on the difficulty of the discrete logarithm rather than of factoring. A similar looking precaution in RSA, choosing primes for which p - 1 has a large factor, guards against something else entirely: Pollard's p - 1 factoring method.
Primes Defined by Digits
- Palindromic primes: Primes that read the same in both directions, such as 101, 131 and 15,451. Apart from 11, no palindromic prime has an even number of digits, since all such palindromes are divisible by 11.
- Repunit primes: Primes consisting entirely of the digit 1. Eight are confirmed, with lengths of 2, 19, 23, 317, 1,031, 49,081, 86,453 and 109,297 digits, and the length must itself be prime.
- Emirps: Primes that give a different prime when their digits are reversed, such as 13 and 31, or 17 and 71.
- Truncatable primes: Primes that stay prime as digits are removed from one end. The largest right-truncatable prime is 73,939,133.
These families depend on base 10 rather than on any intrinsic arithmetic property. Many are popular in recreational mathematics, but some, notably repunit primes, also motivate substantial computational research.
Rare and Formula-Based Primes
- Primorial primes: Primes of the form p# ± 1, where p# is the product of all primes up to p. This form appears in Euclid's proof that the primes are infinite.
- Factorial primes: Primes one more or one less than a factorial, such as 5, 7, 23 and 719.
- Proth primes: Primes of the form k · 2n + 1 with k odd and smaller than 2n. Proth's theorem gives them a fast primality test, and they have supplied many large non-Mersenne records. Other forms, particularly generalized Fermat primes, also occupy leading positions in current record lists.
- Wieferich primes: Only 1093 and 3511 are known, despite searches extending far beyond 1017. They arise in work on Fermat's Last Theorem.
- Wilson primes: Only 5, 13 and 563 have been found, with no others below 2 × 1013.
Why the Classifications Matter
These categories are not merely descriptive. Families with a simple algebraic form often admit specialized primality tests that are far quicker than general methods, which is why record searches concentrate on special forms such as Mersenne, Proth and generalized Fermat numbers. Other families matter to applications, as with the safe primes used in key exchange. Rare types such as Wieferich and Wilson primes are valued precisely because so few examples exist, since each one constrains conjectures that would otherwise be difficult to test.
Explore More Prime Number Topics
Test a number of any of these forms with our Prime Number Check, or read about how to check whether a number is prime, the history of prime numbers, and active prime number money prizes.
Sources & Further Reading
- GIMPS: Current Search Progress- current exponent coverage, known Mersenne primes and record-prime discoveries.
- PrimePages: Repunit Primes- proven base-10 repunit primes and their proof records.
- Wikipedia: Mersenne prime- Properties, discovery records, and Lucas-Lehmer primality testing for Mersenne numbers.
- Wikipedia: Twin prime- Definitions, the Twin Prime Conjecture, Brun's constant, and bounded gap proofs.
- Wikipedia: Fermat prime- The five known Fermat primes and their connection to regular polygon constructibility.
- Wikipedia: Sophie Germain prime- Historical background and modern cryptographic applications of safe primes.
- Wikipedia: Palindromic prime- Digit-based prime classifications and base-10 properties.
- Wikipedia: Proth prime- Algebraic formulation of Proth numbers and Proth's theorem for primality testing.
- Wikipedia: Wieferich prime- Modular criteria related to Fermat's Last Theorem and computational search limits.
- Wolfram MathWorld: Safe Prime- Formal definitions, properties, and group theory relevance in cryptography.