A natural number is prime if it has no divisors other than itself and . Equivalently, it has the property that if [1] then or . Conventionally, is considered to be neither prime nor composite (i.e. non-prime).
If we want to create a list of all the primes below a given number, or the first primes for some fixed , then an efficient way to do it is the Sieve of Eratosthenes. (There are other sieves available, but Eratosthenes is the simplest.)
There are many tests for primality and for compositeness.
That is, divides the product