Prime Numbers and Composite Numbers
How to check whether a number is prime or not?
To check whether a given number N is prime or not, first find the square root of that number N and then approximate that to immediately lower integer (say n) and write down all the prime numbers less than that integer (n). Then check the divisibility of the given number N by all the prime numbers we have written in previous step, if it is not divisible by any of the prime numbers then given number N is prime.
Let us write algorithm for the same
Step 1: Find square root of N, call it as K (Just find approximate values)
Step 2: Write down all the prime numbers less than K.
Step 3: Check divisibility of N with these prime numbers, which we have got in Step 2.
Step 4: If N is not divisible by any of the prime numbers then N is prime.
Let us check whether 211 is prime or not?
Step 1: We find square root of 211 i.e. K=√211 = 14.52
Step 2: We write all primes less than 14.52 i.e. 2, 3, 5, 7, 11 and 13.
Step 3:Since 211 is not divisible by any of these prime numbers, hence 211 is a prime number.
Let us check whether 313 is prime or not?
Step 1: We find square root of 313 i.e. K=√311 = 17.69
Step 2: We write all primes less than 17.69 i.e. 2, 3, 5, 7, 11, 13 and 17
Step 3:Since 313 is not divisible by any of these prime numbers, hence 313 is a prime number.
Number which is the product of two or more than two distinct or same prime numbers is said to be composite number Or we say that if a number has more than two factors then it is said to be a composite number.
For example 4, 6, 8, 15………..are all composite numbers
We can write 4 = 2 × 2,
6 = 2 × 3.
Some points to remember
- 1 is neither prime nor composite.
- 2 is the only prime number which is even. Rest all prime numbers are odd.