Prime Numbers
Prime number are the number which have only 2 divisor...1 and itself...
Example:
2 3 5 7 11 13 17 19 23 …..
Prime number have many application in computer science....ans also
There are many methods to check weather a number is PRIME or not.
Example:
- Fermat Method
- Miller–Rabin
- Solovay-Strassen
- Lucas Primality Test
Different Algorithms to check the prime numbers:
- Sieve of Eratosthenes
- Segmented Sieve
- Sieve of Sundaram
- Bitwise Sieve
We will see each method and algorithm in different post.
In this Post we will discuss the basic method to test the number weather the number is Prime or not
Simple Approach:
In this approach we will iterate over all the number from 1 to N-1 and check weather
that number divides the number or not....
Here is simple CPP program for the above approach..

Nice...bro
ReplyDeleteChokkas
ReplyDeletegreat effort
ReplyDeleteThank you....means alot..
ReplyDelete