Eratosthenes (276–194 BCE) described an algorithm for finding all primes up to any limit. Start with 2 — the first prime. Strike out all its multiples. Move to the next un-struck number. Repeat. What remains, un-struck, is prime.
Each highlighted number is the current prime. Red cells are composites being eliminated. Violet cells are confirmed primes. Watch the gaps widen as numbers grow.
The density of primes decreases as numbers grow — the prime number theorem says there are approximately N / ln(N) primes up to N. But the exact distribution of gaps between primes is irregular and largely mysterious. No one knows how to predict where the next prime falls. The Riemann hypothesis, if proved, would tightly bound how irregular the distribution can be.