Upload
amitbajajmaths
View
483
Download
0
Embed Size (px)
Citation preview
Algorithm to check whether the given number is Prime or not.
Test:
Let p be the given number. Find a whole number nearly greater than .Let k > Test whether p is divisible by any prime number less than k. If yes, p is not a prime. Otherwise, p is prime.
Example:Is 391 a prime?
Solution:Here p = 391Clearly 20 > Prime numbers less than 16 are 2, 3, 5, 7, 11, 13, 17 and 19.We find that 391 is divisible by 17.So, it is not a prime.