Around 240 BC, the Greek polymath Eratosthenes of Cyrene wrote down a recipe for finding every prime up to some limit . Start with all integers from 2 to . The smallest unmarked number must be prime — because nothing smaller divided it. Cross out all of its multiples. Repeat. What survives is exactly the primes.
The elegance is hard to improve on: you never divide, you never test primality — you only count and cross out. It is one of the oldest algorithms in existence, and modern computers still use variants of it to generate prime tables millions of entries long in fractions of a second.
But beneath the simplicity lies a fascinating complexity story. How many crossings-out do you actually do? Why is the classic sieve slightly better than , and can a cleverer version reach true ? And why do primes matter so much that engineers still spend microseconds optimizing this 2,200-year-old recipe?
Comments
Loading comments...