Now that you know what a prime is, let's find them. Discover the methods, the records, and the curious spaces in between.
01 / Numbers at an extraordinary scale
The largest known primes.
The current top five are all Mersenne primes: one less than a power of two. Their special form makes efficient primality proofs possible with the Lucas-Lehmer test.
Top five, checked against PrimePages on October 7, 2026. Dates below are discovery dates.
Rank
Prime
Decimal digits
Discovered
Type
01
2136,279,841 − 1
41,024,320
October 2024
Mersenne
02
282,589,933 − 1
24,862,048
December 2018
Mersenne
03
277,232,917 − 1
23,249,425
December 2017
Mersenne
04
274,207,281 − 1
22,338,618
January 2016
Mersenne
05
257,885,161 − 1
17,425,170
January 2013
Mersenne
A cloud-sized discovery
Luke Durant's network spanned thousands of GPUs across 24 datacenter regions in 17 countries. An NVIDIA A100 in Dublin reported a probable prime on October 11, 2024; an H100 in San Antonio confirmed primality with Lucas-Lehmer on October 12.
Independent tests on different hardware and programs then verified the result.
A special form. Not a guarantee.
If 2p − 1 is prime, p must be prime. The reverse does not always hold: 211 − 1 = 2,047 = 23 × 89.
Other forms also produce enormous primes. The sixth-largest entry is the generalized Fermat prime 2,524,1902,097,152 + 1, with 13,426,224 digits, discovered in 2025.
Think of a series of identity checks. A failed check exposes a composite. Passing many checks makes a number a strong probable-prime candidate.
Handle 2, 3, and even numbers first. For odd n > 3, write n − 1 = 2sd with d odd.
Choose a base a from 2 through n − 2 and calculate ad mod n. If the result is 1 or n − 1, this round passes.
Otherwise, square modulo n up to s − 1 times. The round passes if a result is n − 1. If none is, n is composite.
For a fixed odd composite, k independently and uniformly chosen random bases have a false-pass probability at most 4−k. That is not the posterior probability that a passing number is composite.
Carefully chosen fixed bases give deterministic results within specified integer bounds. Outside those bounds, passing rounds alone is not a proof.
PROVES PRIMALITYDETERMINISTIC POLYNOMIAL TIME
The AKS primality test
Agrawal, Kayal, and Saxena's 2002 breakthrough proved that primality can be decided deterministically in polynomial time without unproved hypotheses.
Its starting idea resembles Fermat's theorem for polynomials: for prime n, (x + a)n ≡ xn + a (mod n). AKS combines perfect-power and factor checks with carefully bounded polynomial congruences modulo xr − 1.
Polynomial in what? The number of digits of n, not n itself. This matters enormously in theory, although Miller-Rabin and specialized tests are generally more practical.
A field guide / Intermediate
One definition. Many fascinating families.
A special name usually adds an extra condition to “prime.” It does not guarantee an easy way to generate infinitely many members. Several innocent-looking families still conceal open problems.
Family
Rule & examples
What is known?
Mersenne
2p − 1: 3, 7, 31, 127
Infinitely many? Unknown.
Fermat prime
22n + 1: 3, 5, 17, 257, 65,537
No other examples are known.
Sophie Germain
p and 2p + 1 prime: p = 2, 3, 5, 11
Infinitely many? Unknown.
Safe prime
q = 2p + 1 with p prime: 5, 7, 11, 23
Useful for some group-based protocols.
Twin primes
(p, p + 2): (3, 5), (11, 13)
Infinitely many? Unknown.
Palindromic prime
Same digits backward: 11, 101, 131
Depends on the number base.
Gaussian prime
Prime element in the integers a + bi
Different from ordinary integer primes.
Perfect numbers and Mersenne primes
A perfect number equals the sum of its positive proper divisors: 6 = 1 + 2 + 3 and 28 = 1 + 2 + 4 + 7 + 14.
Euclid and Euler together characterize every even perfect number: 2p−1(2p − 1), where the Mersenne factor is prime. Whether any odd perfect number exists remains unknown.
A base-dependent pattern
Every even-length decimal palindrome is divisible by 11: its alternating digit sum is zero. Therefore the only even-length palindromic prime in base 10 is 11.
Primality itself is independent of notation. A number stays prime when written in binary; only the appearance of its digits changes.
03 / The spaces in between
Close neighbors. Vast distances.
A prime gap is the difference between consecutive primes. The primes are not random, but their local spacing is irregular. Near a large x, the average spacing is approximately ln(x).
01
The smallest gap
The gap between 2 and 3 is 1. It happens exactly once. Since 2 is the only even prime, all later primes are odd, so all later gaps are even and at least 2.
∞
No largest possible gap
For any n ≥ 2, the integers n! + 2, n! + 3, …, n! + n are all composite. Each n! + k is divisible by k. That gives n − 1 consecutive composites, as long a run as you like.
Largest known gaps with identified endpoints
Proven endpoints: 1,113,106. The primes at either end each have 18,662 digits. Found by P. Cami, M. Jansen, and J. K. Andersen.
Probable-prime endpoints: 16,045,848. Found by Andreas Höglund in March 2024, with endpoints of 385,713 digits. These endpoints passed strong tests but lack a final primality proof.
These are computational records with identified endpoints, not upper bounds on how big a gap can be.
370,261 and 370,373 are consecutive primes. Their gap is 112, containing 111 composite integers strictly between them.
370,261–370,360: 100 integers, one prime (370,261).
370,262–370,361: 100 integers, zero primes.
These are sliding windows, not blocks aligned to multiples of 100. In the smaller window 91–100, only 97 is prime.
And yet, primes stay close.
The Twin Prime Conjecture says there are infinitely many prime pairs exactly 2 apart, such as 11 and 13. It remains unproved.
2013: Yitang Zhang proves infinitely many pairs have gaps at most 70 million.
2013–2014: Maynard and Tao develop stronger methods; the Polymath collaboration lowers the unconditional bound to 246.
A finite bound is a breakthrough. It is not yet a proof of the bound 2.
Choosing the right tool / Intermediate → Advanced
Testing, factoring, counting: three different jobs.
Primality testing
Answer a yes/no question about one integer. A proof may come from trial division, a primality certificate, ECPP, or a specialized theorem such as Lucas-Lehmer. Miller-Rabin is often an efficient filter before a more definitive step.
Integer factorization
Find the prime ingredients of a composite. Pollard rho can find small factors; elliptic-curve factorization depends strongly on factor size; the number field sieve handles large general inputs. Knowing “composite” need not tell you a factor.
Prime counting
Compute π(x), the number of primes at most x. Segmented sieves process manageable blocks; combinatorial counting algorithms can avoid listing every prime explicitly. A count is not a list of every prime.
How does a segmented sieve save memory?
First sieve the primes up to √N. Then process one interval [L, R] at a time, crossing out multiples of those base primes. Begin each prime's work at the larger of p² and the first multiple of p in the interval. You keep only one block in memory, rather than a flag for every integer up to N.
Why use BigInt for modular powers?
Ordinary JavaScript numbers represent integers exactly only up to 253 − 1. Even when n fits, multiplying two residues below n can exceed that range. BigInt keeps modular multiplication exact. Repeated squaring evaluates ae mod n with a number of squarings proportional to the bit length of e, not e itself.
What counts as a primality certificate?
A certificate packages evidence that a separate verifier can check. The expensive search for a proof may be much harder than verification. Pocklington-style criteria and elliptic-curve primality proving are examples; do not confuse a repeatable probable-prime test with a full certificate.
How does Lucas-Lehmer test Mersenne candidates?
For odd prime p, set M = 2p − 1 and s = 4. Apply s ← s² − 2 (mod M) exactly p − 2 times. M is prime exactly when the final residue is zero. The case p = 2 is handled separately. Efficient arithmetic exploiting M's special form makes this useful for record searches.
See actual counts and gaps in the visual atlas, then compare computational discovery with new theorems on the research desk.