Hotmath
Math Homework. Do It Faster, Learn It Better.

Prime & Composite Numbers

Definition: A prime number is a whole number with exactly two integral divisors, 1 and itself.

The number 1 is not a prime, since it has only one divisor.

So the smallest prime numbers are:

2 , 3 , 5 , 7 ,

The number 4 is not prime, since it has three divisors ( 1 , 2 , and 4 ), and 6 is not prime, since it has four divisors ( 1 , 2 , 3 , and 6 ).

Definition: A composite number is a whole number with more than two integral divisors.

So all whole numbers (except 0 and 1 ) are either prime or composite.

Example:

43 is prime, since its only divisors are 1 and 43 .

44 is composite, since it has 1 , 2 , 4 , 11 , 22 and 44 as divisors.

How can you tell if a number is prime?

First of all, here are some ways to tell if a number is NOT prime:

Any number greater than 2 which is a multiple of 2 is not a prime, since it has at least three divisors: 1 , 2 , and itself. (This means 2 is the only even prime.)

Any number greater than 3 which is a multiple of 3 is not a prime, since it has 1 , 3 and itself as divisors. (For example, 303 is not prime, since 303 ÷ 3 = 101 .)

Any number which is a multiple of 4 is also a multiple of 2 , so we can rule these out.

Any number greater than 5 which is a multiple of 5 is not a prime. (So the only prime number ending with a 0 or 5 is 5 itself.)

Any number which is a multiple of 6 is also a multiple of 2 and 3 , so we can rule these out too.

You can continue like this... basically, you just have to test for divisibility by primes!

Example 1:

Is 119 prime?

First test for divisibility by 2 . 119 is odd, so it's not divisible by 2 .

Next, test for divisibility by 3 . Add the digits: 1 + 1 + 9 = 11 . Since 11 is not a multiple of 3 , neither is 119 . (Remember, this trick only works to test divisibility by 3 and 9 .)

Since 119 doesn't end in a 0 or a 5 , it's not divisible by 5 .

Next, test for divisibility by 7 . You'll find that 119 ÷ 7 = 17 .

So the answer is NO... 119 is not prime.

Example 2:

Is 127 prime?

First test for divisibility by 2 . 127 is odd, so it's not divisible by 2 .

Next, test for divisibility by 3 . Add the digits: 1 + 2 + 7 = 10 . Since 10 is not a multiple of 3 , neither is 127 .

Since 127 doesn't end in a 0 or a 5 , it's not divisible by 5 .

Next, test for divisibility by 7 . You'll find that 7 doesn't go in evenly.

The next prime is 11 . But 11 doesn't go in evenly, either.

You can stop now... it must be prime! You don't need to keep checking for divisibility by the next primes ( 13 , 17 , 19 , 23 , etc.). The reason is that if 13 went in evenly, then we would have 127 = 13 × n for some number n . But then n would have to be less than 13 ... and we already know that 127 is not divisible by any number smaller than 13 .

So the answer is YES... 127 is prime.

For more advanced topics and a list of the first 400 primes, go to the Prime Page or the page on prime factorization .