* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Chapter 3: Primes and their Distribution
Survey
Document related concepts
Transcript
Chapter 3: Primes and their Distribution 5 Chapter 3: Primes and their Distribution SECTION B Testing Numbers By the end of this section you will be able to understand B1 Floor and Ceiling Function The floor function is defined as: Definition (3.7). The floor function is denoted by x and is the greatest integer less than or equal to x. The domain and range of the floor function are and respectively. We have x : For example 7.1 7 , 3 , e 2 , 2.1 2 , 2.1 3 The graph of the floor function is Fig 2 Next we define the ceiling function. Definition (3.8). The ceiling function is denoted by x and is the least integer greater than or equal to x. The domain and range of the floor function are and respectively. We have x : . For example 7.1 8 , 4 , e 3 , 2.1 3 , 2.1 2 The graph of the floor function is Chapter 3: Primes and their Distribution 6 B2 Testing of Composite Numbers How can we test whether a given number is prime or composite? The following proposition is a useful test for small composite numbers: Proposition (3.9). If n is composite then it has a divisor d such that 1 d n . How do we prove this result? By contradiction. Proof. We are given that n is composite. This means there exists integers 1 d1 n and 1 d2 n such that n d1d 2 Suppose d1 n and d2 n . We have n d1d2 n n n This is impossible. Our supposition must be wrong so one of d1 or d 2 must be n . ■ Examples are 315 32 5 7 983 983 (a prime number) 1001 7 1113 Note that for testing whether 983 is prime we need to see if all the numbers from 2 to 983 31 go into 983. This is still a tedious task. Can we simplify the above test? Yes. Chapter 3: Primes and their Distribution 7 Corollary (3.10). If n is composite then it has a prime divisor p such that p n . Proof. By the above Proposition (3.9): If n is composite then it has a divisor d such that 1 d n . we have that n has a divisor d such that 1 d n . By the Fundamental Theorem of Arithmetic there exists a prime p such that p d . Hence p n . ■ How does this simplify the test for composite numbers? Well for testing whether 983 is prime or composite we only need to see if the primes less than or equal to 983 31 go into 983. The primes 31 are 2, 3, 5, 7, 11, 13, 17, 19, 23, 29 and 31 There are 11 primes 31 and we only need to see if these are proper divisors of 31. By the earlier proposition (3.9) we would have had to check whether all the numbers between 2 and 31 are divisors of 983. Corollary (3.10) means that to test a given positive integer n for primality we only have to divide by the prime numbers between 2 and n . Example 1 Test 1001 for prime. If 1001 is composite write down its prime decomposition Solution We first find 1001 31.63858404 31 . We only need to check the primes: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29 and 31 2 and 3 clearly do not go into 1001 exactly. What about 7? Well 7 143 1001. This means that 1001 is composite. What are the other divisors of 1001? To check if 143 is prime we only need to if the primes less than or equal to 143 11 are divisors of 143. 7 is not a divisor of 143. What about 11? 1113 143 Hence the prime divisors of 1001 are 7, 11 and 13: 1001 7 1113 B3 Eratosthenes Sieve The diagram below shows the Sieve of Eratosthenes for integers less than or equal to 100. First we write down all the integers between 2 and 100. Since 2 is prime we cross out all the multiples of 2 or the even numbers apart from 2 itself. The first of the remaining integers is 3 so it must be a prime. Now we cross out all the multiples of 3 apart from 3 itself. We continue this process for 5, 7, 11, 13, … The integers which do not fall into this sieve are the prime numbers: Chapter 3: Primes and their Distribution 8