The following method of finding all the primes up to some given number N. List all the positive integers from 2 up to N. Leave the first number, 2, but delete all its multiples; leave the next remaining number, 3, but delete all its multiples; leave the next remaining number, 5, but delete all its multiples, and so on. The integers not deleted when the process ends are the primes.
http://www.faust.fr.bw.schule.de/mhb/eratosiv.htm An interactive animation of the sieve of Eratosthenes used to obtain prime numbers.