## Prime Number in Discrete Mathematics## OverviewAn integer p > 1 will be known as the prime or prime number if and only if 1 and p are the only positive divisor of p. In simple term, any number will be known as prime number if it is divided only by 1 and itself. There is also a term known as composite that will occur if an integer q > 1 is not prime. That means if a number is divided by any other number, then it will be known as composite. In other word we can say that if a number is not prime then it will be composite.
The integers 4, 6, 8, 9 are called composite, and the integers 2, 3, 5, 7, and 11 are called the prime numbers.
An integer p > 1 will be known as a prime if for all integers x and y, p divides xy. This statement means that for prime number, p either divides x or y.
Every integer n > = 2 must contains a prime factor.
Suppose composite integer is shown by n. In this case, n must have a prime factor that will not exceed √n. ## Examples of prime numbers are described as follows:
In this example, we have two integers, and we have to determine which one is prime. The first integer is 293, and the second integer is 9823.
First, we will find out all the primes p in such a way that p Now we will find out primes p in such a way that p
In this example, we will assume n as a positive integer in such a way that n Here n
In this example, we will assume p as a prime integer in such a way that gcd (a, p
To solve this, we will take the given condition gcd (a, p
In this example, we are going to make the algorithm more efficient, 36 =
## Algorithm to find Prime NumbersThe sieve of Eratosthenes is a type of ancient algorithm which is used in mathematics to determine all prime numbers up to any amount of giving length. The input and output of Sieve of Eratosthenes are described as follows: Input: an integer n > 1. Output: It will generate all prime numbers from 2 through n. Here we will assume an array A of Boolean values, which is indexed with the help of integers 2 to n, initially all set to true. for i = 2, 3, 4, ....., not exceeding √n do if A [i] is true for j = i |