LEVEL 02 · INTERMEDIATE

Order in the
unexpected.

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.
RankPrimeDecimal digitsDiscoveredType
012136,279,841 − 141,024,320October 2024Mersenne
02282,589,933 − 124,862,048December 2018Mersenne
03277,232,917 − 123,249,425December 2017Mersenne
04274,207,281 − 122,338,618January 2016Mersenne
05257,885,161 − 117,425,170January 2013Mersenne

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.

Live PrimePages list · GIMPS: the 2024 discovery. Records can change; these are dated snapshots, not live results.

02 / Different questions. Different tools.

How do we find a prime?

Listing every small prime and proving that one enormous number is prime are different jobs. Select a method to see how it works.

GENERATES PRIMESO(n log log n)

The Sieve of Eratosthenes

Think of sifting sand: remove what doesn't belong, and the primes remain. This method lists all primes up to a chosen limit.

  1. Write down the integers from 2 through n. Keep 1 separate: it is neither prime nor composite.
  2. Take the smallest uncrossed number p. It's prime. Cross out its multiples, starting at p²; smaller multiples were already handled.
  3. Repeat for uncrossed p up to √n. Every uncrossed number remaining is prime.

Why stop at √n? Every composite at most n has a prime factor at most √n.

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.

FamilyRule & examplesWhat is known?
Mersenne2p − 1: 3, 7, 31, 127Infinitely many? Unknown.
Fermat prime22n + 1: 3, 5, 17, 257, 65,537No other examples are known.
Sophie Germainp and 2p + 1 prime: p = 2, 3, 5, 11Infinitely many? Unknown.
Safe primeq = 2p + 1 with p prime: 5, 7, 11, 23Useful for some group-based protocols.
Twin primes(p, p + 2): (3, 5), (11, 13)Infinitely many? Unknown.
Palindromic primeSame digits backward: 11, 101, 131Depends on the number base.
Gaussian primePrime element in the integers a + biDifferent 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.

Prime-gap numerical results and references, checked October 7, 2026.

A hundred numbers. One prime.

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.
← Back to the foundationsLevel 03: Beyond the obvious →