Sieve of Eratosthenes is a simple, ancient algorithm for finding all prime numbers up to a specified integer.
Sieve of Eratosthenes finds primes among the natural numbers above 1 between the composites, which it finds by direct enumeration from each prime (optimization: prime's square), as an arithmetic progression with the step equal to that prime.
The first prime number is 2.
In pseudocode, the timing issues aside, it is
primes = [2, 3, ...] \ [[p*p, p*p+p, ...] for p in primes]