Prime Numbers in Discrete Mathematics
An integer p>1 is called a prime number, or prime if the only positive divisors of p are 1 and p. An integer q>1 that is not prime is called composite.
The integers 2,3,5,7 and 11 are prime numbers, and the integers 4,6,8, and 9 are composite.
An integer p>1 is prime if and only if for all integers a and b, p divides ab implies either p divides a or p divides b.
Consider the integer 12.Now 12 divides 120 = 30 x 4 but 12|30 and 12|4.Hence,12 is not prime.
Every integer n>=2 has a prime factor.
If n is a composite integer, then n has a prime factor not exceeding √n.
Determine which of the following integers are prime?
a) 293 b) 9823
- We first find all primes p such that p2< = 293.These primes are 2,3,5,7,11,13 and 17.Now, none of these primes divide 293. Hence, 293 is a prime.
- We consider primes p such that p2< = 9823.These primes are 2,3,5,7,11,13,17, etc. None of 2,3,5,7 can divide 9823. However,11 divides 9823.Hence, 9823 is not a prime.
Let n be a positive integer such that n2-1 is prime. Then n =?
We can write, n2-1 = (n-1)(n2+n+1). Because n3-1 is prime, either n-1 = 1 or n2+n+1 = 1.Now n>=1, So n2+n+1 > 1,i.e., n2+n+1 != 1.Thus, we must have n-1 = 1.This implies that n=2.
Let p be a prime integer such that gcd(a, p3)=p and gcd(b,p4)=p. Find gcd(ab,p7).
By the given condition, gcd(a,p3)=p. Therefore, p | a. Also, p2|a.(For if p2| a, then gcd (a,p3)>=p2>p, which is a contradiction.) Now a can be written as a product of prime powers. Because p|a and p2| a, it follows that p appears as a factor in the prime factorization of a, but pk, where k>=2, does not appear in that prime factorization. Similarly ,gcd(b,p4)=p implies that p|b and p2|b. As before, it follows that p appears as a factor in the prime factorization of a, but pk, where k>=2, does not appear in that prime factorization. It now follows that p2|ab and p3|ab. Hence, gcd(b,p7) = p2 .
Primality Test Algorithm :
for i: [2,N-1] if i divides N return "Composite" return "Prime"
Let’s take an example and makes the algorithm more efficient, 36=
Take the inputs of a and b until, a<=b a . b = N a . N/a = N
Modified algorithm :
for i : [2,√n] if i divides N return "Composite" return "Prime"
Algorithm to find prime numbers :
In mathematics, the sieve of Eratosthenes is an ancient algorithm for finding all prime numbers up to any given limit.
Algorithm Sieve of Eratosthenes is input: an integer n > 1. output : all prime numbers from 2 through n. let A be an array of Boolean values, indexed by 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 = i2, i2+i, i2+2i, i2+3i, ..., not exceeding n do A[j] := false return all i such that A[i] is true.
Please Login to comment...