Monday, July 18, 2011

How to find if the no. is prime or not

An easy way of finding if the no. is prime or not can be summarized in the following steps:

1)If the no. ends with 0,2,4,5,6,8 ; it is not prime.

2)Find the square root of the number and round it of to a lower integer. Find if the resultant number is divisible by prime numbers below it. If it is not, it is a prime number and if it is, it is a composite number.


Eg: If we want to check for 181. Square root 181 lies between 13 and 14. Therefore rounding of to lower integer, the resulting number is 13. Since 13 is not divisible by 2,3,5,7,11; we conclude that 181 is a prime number.

Try for higher numbers as well, this method works.

No comments: