A curated, verified repository of 1,000,000,000 prime numbers — one prime per line, spanning from 2 to 22,801,763,489. All primes are generated by primesieve (a highly optimized segmented Sieve of Eratosthenes) and cross-checked against known landmark values from OEIS A000040.
Each file contains exactly 100,000 consecutive primes, named by the ordinal count at the end of the file.
- 10,000 files across 20 directories, each directory containing 500 files (50,000,000 primes)
- File
Nkcontains primes #(N−100,000 + 1) through #N - The number in the filename equals the index of the last prime in that file
| Directory | Prime indices | First prime | Last prime |
|---|---|---|---|
1-to-50M/ |
#1 – #50,000,000 | 2 | 982,451,653 |
50M-to-100M/ |
#50,000,001 – #100,000,000 | 982,451,667 | 2,038,074,743 |
100M-to-150M/ |
#100,000,001 – #150,000,000 | 2,038,074,751 | 3,124,562,833 |
150M-to-200M/ |
#150,000,001 – #200,000,000 | 3,124,562,843 | 4,222,234,741 |
200M-to-250M/ |
#200,000,001 – #250,000,000 | 4,222,234,763 | 5,323,738,027 |
| … | … | … | … |
950M-to-1B/ |
#950,000,001 – #1,000,000,000 | 21,660,344,591 | 22,801,763,489 |
Within each directory, selected landmark files:
| File | Prime index | Value |
|---|---|---|
100k |
#100,000 | 1,299,709 |
1000k |
#1,000,000 | 15,485,863 |
10000k |
#10,000,000 | 179,424,673 |
100000k |
#100,000,000 | 2,038,074,743 |
500000k |
#500,000,000 | 11,037,271,757 |
1000000k |
#1,000,000,000 | 22,801,763,489 |
Total: 1,000,000,000 primes (2 through 22,801,763,489)
Verified against OEIS landmark values:
| Index | Prime | Source |
|---|---|---|
| 1 | 2 | OEIS A000040 |
| 100,000 | 1,299,709 | OEIS A000040 |
| 500,000 | 7,368,787 | OEIS A000040 |
| 1,000,000 | 15,485,863 | OEIS A000040 |
| 10,000,000 | 179,424,673 | OEIS A000040 |
| 50,000,000 | 982,451,653 | OEIS A000040 |
| 100,000,000 | 2,038,074,743 | OEIS A000040 |
| 200,000,000 | 4,222,234,741 | OEIS A000040 |
| 500,000,000 | 11,037,271,757 | OEIS A000040 |
| 1,000,000,000 | 22,801,763,489 | OEIS A000040 |
A prime number is a natural number greater than 1 whose only positive divisors are 1 and itself. The number 1 is not prime by convention (it has only one divisor). The sequence begins:
Key properties:
- 2 is the only even prime.
- There are infinitely many primes (proved by Euclid, ~300 BCE).
- Every integer
$\geq 2$ factors uniquely into primes — the Fundamental Theorem of Arithmetic.
Prime numbers aren't just mathematical curiosities — they are foundational to modern technology and science.
Nearly all public-key cryptography depends on the difficulty of problems involving large primes:
- RSA encryption — The security of RSA rests on the fact that multiplying two large primes is easy but factoring their product is computationally infeasible. An RSA key is computed as:
where
-
Diffie-Hellman key exchange — Uses a large prime
$p$ and a generator$g$ of the multiplicative group$(\mathbb{Z}/p\mathbb{Z})^*$ . Two parties exchange$g^a \bmod p$ and$g^b \bmod p$ to arrive at a shared secret$g^{ab} \bmod p$ without ever transmitting$a$ or$b$ . -
Elliptic Curve Cryptography (ECC) — Operates over finite fields
$\mathbb{F}_p$ for a prime$p$ . ECC provides equivalent security to RSA with much smaller keys (256-bit ECC ≈ 3072-bit RSA). -
Digital signatures (DSA, ECDSA), TLS/HTTPS, SSH, PGP/GPG, cryptocurrency wallets — all rely on prime-based math.
-
Hash table sizing — Using a prime number for the table size minimizes clustering in open addressing and chaining. If
$m$ is prime, the hash function$h(k) = k \bmod m$ distributes keys more uniformly. - Double hashing — The step size in double hashing schemes is often chosen as a prime to guarantee all slots are visited.
-
Bloom filters — Use
$k$ independent hash functions, often designed using prime moduli.
-
Cyclic Redundancy Checks (CRC) — CRC polynomials are chosen to be irreducible over
$\mathbb{F}_2$ , a concept directly analogous to primality. -
Reed-Solomon codes — Operate over finite fields
$\mathbb{F}_{p^k}$ , used in QR codes, CDs, DVDs, satellite communications, and deep-space probes (Voyager, Mars rovers).
-
Linear congruential generators — The modulus is often a large prime (e.g., the Mersenne prime
$2^{31} - 1 = 2{,}147{,}483{,}647$ in many implementations). -
Cryptographically secure PRNGs rely on prime-field arithmetic (e.g., Blum Blum Shub:
$x_{n+1} = x_n^2 \bmod M$ , where$M = pq$ for primes$p, q \equiv 3 \pmod{4}$ ).
-
Testing conjectures — Having a dataset of 1 billion primes lets researchers verify conjectures (twin primes, Goldbach, prime gaps, etc.) up to
$22.8 \times 10^9$ . - Computational experiments — Prime distribution patterns, prime gaps statistics, counts of special prime types.
- Benchmarking algorithms — Verifying the output of new sieve implementations or primality tests.
- Quasi-random sampling — Prime-based spacing produces low-discrepancy sequences, useful in Monte Carlo integration and computer graphics.
- Cicada life cycles — Periodical cicadas emerge on 13- and 17-year cycles (both primes), hypothesized to minimize predator synchronization.
- Nuclear physics — Energy levels of certain heavy nuclei show statistical spacing distributions related to the zeros of the Riemann zeta function — a deep and still mysterious connection between primes and physics.
-
Rabin-Karp string matching — Computes rolling hashes modulo a prime to efficiently find substring matches in
$O(n)$ expected time. -
Universal hashing — Hash families parameterized by random coefficients over
$\mathbb{F}_p$ provide provably low collision probability. - Primality certificates — Pratt certificates and ECPP certificates provide independently verifiable proofs that a number is prime.
-
Miller-Rabin testing — A list of known primes provides deterministic witness sets. For all
$n < 3{,}215{,}031{,}751$ , the witnesses${2, 3, 5, 7}$ are sufficient.
- Learning tool — A billion primes in plain text is directly usable in any programming language for teaching number theory, algorithms, and data analysis.
- Programming exercises — Sieving, searching, gap analysis, twin prime enumeration, Goldbach verification.
| In this repo? | ||
|---|---|---|
| ✓ | ||
| ✓ | ||
| ✓ | ||
| ✓ | ||
| ✓ | ||
| ✓ | ||
| ✓ | ||
| ✓ | ||
| ✓ | ||
| ✓ | ||
✓ last prime (file 1000000k) |
||
| — | ||
| — |
Source: OEIS A006880.
Proved independently by Hadamard and de la Vallée-Poussin in 1896:
A sharper approximation uses the logarithmic integral:
Assume there are finitely many primes
For any two coprime positive integers
For example, there are infinitely many primes ending in 1, 3, 7, or 9 — each residue class mod 10 contains the same asymptotic density
For every integer
Proved by Chebyshev (1852). For example: between 100 and 200 there are 21 primes; between 10,000,000 and 15,485,863 (the range of the second half of this repo) there are over 400,000 primes.
Bernhard Riemann (1859) defined the Riemann zeta function:
The second expression (Euler's product formula) directly encodes all primes. The Riemann Hypothesis — one of the Millennium Prize Problems, worth $1,000,000 — conjectures that every non-trivial zero of ζ(s) has real part exactly 1/2. Proving it would give the sharpest possible error bound on the PNT:
As of 2026, more than 10 trillion non-trivial zeros have been computed and all lie on the critical line Re(s) = 1/2, but no proof exists.
A Mersenne prime is a prime of the form
The largest known prime (as of 2024) is the Mersenne prime
The Great Internet Mersenne Prime Search (GIMPS) coordinates the search.
Twin primes are pairs
The Twin Prime Conjecture states there are infinitely many such pairs. Unproven. Yitang Zhang (2013) proved there are infinitely many prime pairs with gap < 70,000,000 — later reduced to 246 by the Polymath project. The gap remains finite but closing it to 2 is an open problem.
A prime
Safe primes are critical in cryptography — they ensure the multiplicative group
Every even integer greater than 2 can be expressed as the sum of two primes:
Proposed by Christian Goldbach (1742), verified computationally up to
The weak Goldbach conjecture (every odd integer > 5 is the sum of three primes) was proved by Harald Helfgott in 2013.
The prime gap after a prime
Cramér's conjecture (1936) predicts the maximal gap near
Selected record gaps visible in this repository:
| Gap | After prime |
Approx. |
Ratio |
|---|---|---|---|
| 72 | 31,397 | 107 | 0.67 |
| 112 | 396,733 | 166 | 0.67 |
| 148 | 2,010,733 | 210 | 0.70 |
| 220 | 13,256,063 | 269 | 0.82 |
| 282 | 265,621,549 | 375 | 0.75 |
| 288 | 436,273,009 | 396 | 0.73 |
| 312 | 2,300,942,549 | 468 | 0.67 |
Source: OEIS A005250 — Increasing gaps between primes.
The merit of a gap is
Fermat numbers have the form:
Fermat conjectured all are prime. Only five Fermat primes are known:
All five appear in this repository.
Fermat primes are significant because a regular
The algorithm used to generate this entire repository. Dating to ~240 BCE, it remains one of the most efficient methods for enumerating all primes up to a bound
- List all integers from 2 to
$N$ . - Starting with the smallest unmarked number
$p$ (initially 2):- Mark all multiples
$p^2, p^2 + p, p^2 + 2p, \ldots \leq N$ as composite. - Advance to the next unmarked number.
- Mark all multiples
- Repeat until
$p^2 > N$ . - All remaining unmarked numbers are prime.
Complexity: primesieve) reduces space to
| Test | Type | Notes |
|---|---|---|
| Trial division | Deterministic |
|
| Sieve of Eratosthenes | Deterministic |
|
| Miller-Rabin | Probabilistic |
|
| AKS | Deterministic polynomial |
|
| Lucas-Lehmer | Deterministic for |
|
| BPSW | Probabilistic (no known counterexample) | Combines Miller-Rabin base-2 + strong Lucas test |
All primes in this repository were generated by primesieve by Kim Walisch — a production-grade implementation of the segmented Sieve of Eratosthenes with wheel factorization, widely regarded as the fastest prime generator available. It generated all 1,000,000,000 primes in this repository in under 3 minutes on a modern CPU.
| Prime | Why notable |
|---|---|
| 2 | Only even prime |
| 3 | Smallest odd prime; also Mersenne prime |
| 5 | Fermat prime |
| 7 | Mersenne prime |
| 17 | Fermat prime |
| 31 | Mersenne prime |
| 127 | Mersenne prime |
| 257 | Fermat prime |
| 8,191 | Mersenne prime |
| 65,537 | Fermat prime |
| 131,071 | Mersenne prime |
| 524,287 | Mersenne prime |
| 1,000,003 | First prime |
| 1,299,709 | The 100,000th prime |
| 7,368,787 | The 500,000th prime |
| 15,485,863 | The 1,000,000th prime |
| 179,424,673 | The 10,000,000th prime |
| 982,451,653 | The 50,000,000th prime |
| 1,000,000,007 | First prime |
| 2,038,074,743 | The 100,000,000th prime |
| 2,147,483,647 | Mersenne prime |
| 4,222,234,741 | The 200,000,000th prime |
| 11,037,271,757 | The 500,000,000th prime |
| 22,801,763,489 | The 1,000,000,000th prime — largest prime in this repo |
A number
For example,
Sequences & databases:
- OEIS A000040 — The prime numbers
- OEIS A006880 — π(10^n)
- OEIS A005250 — Increasing gaps between primes
- OEIS A019434 — Fermat primes
- The Prime Pages — primes.utm.edu
- Great Internet Mersenne Prime Search (GIMPS)
Key Wikipedia articles:
- Prime number
- Prime Number Theorem
- Riemann Hypothesis
- Riemann zeta function
- Mersenne prime
- Fermat number
- Twin prime conjecture
- Goldbach's conjecture
- Prime gap
- Dirichlet's theorem
- Sieve of Eratosthenes
- RSA cryptosystem
Millennium Prize:
Books:
- An Introduction to the Theory of Numbers — G.H. Hardy & E.M. Wright
- The Music of the Primes — Marcus du Sautoy
- Prime Obsession: Bernhard Riemann and the Greatest Unsolved Problem in Mathematics — John Derbyshire
- The Little Book of Bigger Primes — Paulo Ribenboim
Tools:
primesieve— Fast prime generator used to create this datasetsympy.isprime()— Python primality testing- SageMath — Open-source mathematics software