Example. Sieve of Eratosthenes [00EK]

The sieve of Eratosthenes is an ancient Greek method for finding all the primes up to some limit; consider as an example finding all the primes up to 100. We start by circling 2 as the first prime, then crossing out all multiples of 2. Since the 3 is not crossed out, it must be prime too. We circle it and cross out all multiples of 3. The 4 is already crossed out now, but 5 is not, which means it must be prime—if it were composite it would have some smaller prime divisor, but we have already crossed out all multiples of smaller primes. So we circle 5 and cross out all its multiples; finally we circle 7 and cross out all its multiples. But now we can stop! We have found all the primes up to \sqrt {100} = 10. The rest of the numbers up to 10 are already crossed out; by the previous theorem, composite numbers up to 100 must have a prime divisor less than or equal to 10, but we have already crossed out all multiples of primes less than 10. So all the remaining numbers must be prime and we can simply circle them.