This is the explanation of the Seive of Eratosthenes from this site:

"That being said, it is still possible to generate prime numbers, at least when they are small. Prime numbers appear pretty frequently at first, but as the counting numbers get bigger the primes get sparser and harder to find. Simple methods quickly get out of hand and unusable.

One staightforward way of producing primes is to keep multiplying all the primes that come before it. If a given number, unknown whether it is prime, gets passed by from all these prime multiples, then it means that it has been “left behind” and so it must be a prime number. If a number is not prime, then it will eventually get “hit upon” and become one of these prime multiples.

To give an example, start with knowing only that 2 is a prime number. When you start making multiples of all the known primes (just 2), you get 2 * 2 = 4. So we know 4 is not prime since it has been “hit upon” by one of the prime number multiples. On the other hand, since all the prime multiples (just 4) have passed by 3, then 3 must be a prime number. Now all the known primes are 2 and 3, and you start the process over to get 5."

Clear?

RonL