Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
1 Chapter 19: Primality Testing and Carmichael Numbers Practice HW p. 127 # 1, 2, 3a, 4 Recall Fermat’s Little Theorem says that if p is a prime number and a is an integer where p | a , then a p 1 1 (mod p) If we multiply both sides by a, we obtain the equivalent expression a a p 1 a 1 (mod p) or a p a (mod p) . Then if a p a (mod p) , then p is composite. Definition 1: An integer a where a p a (mod p) that shows p is composite is called a witness of p. For example, 2, 3, 7, 8, 12, and 13 are witnesses of the composite number 15 since 215 8 2 (mod 15) 315 12 3 (mod 15) 715 13 7 (mod 15) 815 2 8 (mod 15) 1215 3 12 (mod 15) 1315 7 13 (mod 15) Note, 9 is not a witness 15 since 915 9 (mod 15) 2 Carmichael Numbers A Carmichael number is a positive integer n where a n a (mod n) for any 1 a n but n is not prime. List of Carmichael Numbers Smaller than 10000 561 3 11 17 2821 7 13 31 1105 5 13 17 6601 7 23 41 1729 7 13 19 8911 7 19 67 2465 5 17 29 How do we determine if a number is a Carmichael number? Facts About Carmichael Numbers 1. Every Carmichael number is odd. Proof Fact 1: █ 3 2. Every Carmichael number is a product of distinct primes (there are no repeated prime factors). Proof Fact 2: █ 4 Korselt’s Criterion for Carmichael Numbers A composite number n is a Carmichael number if and only it is odd and for all primes p where p | n , the following conditions are satisfied: 1. p 2 | n 2. ( p 1) | (n 1) Proof: Assume n is odd and for any prime p where p | n , p 2 | n and ( p 1) | (n 1) . To show that n is Carmichael, we want to show that a n a (mod n) for any 1 a n 1 . Since p 2 | n for any prime where p | n , if we compute n' s prime factorization n p1 p2 pr , then the pi ’s are distinct. Also, since ( p 1) | (n 1) for any prime p | n , for all the primes pi in n' s factorization, we know that ( pi 1) | (n 1) or (n 1) ( pi 1)k This leads to two cases. Case 1: If pi | a , then a 0 (mod pi ) for all primes pi in n’s factorization. Hence, a n 0 (mod pi ) or a n a (mod pi ) . Case 2: If pi | a , then an a n 1 a (mod pi ) a ( pi 1) k a (mod pi ) ( a ( pi 1) ) k a (mod pi ) (1) k a (mod pi ) a (mod pi ) Thus, a n a (mod pi ) and pi | (a n a ) for all of the primes in n’s factorization. Hence, for n p1 p2 pr , since gcd( pi , p j ) 1 where i j , it is not hard to show that p1 p2 pr | (a n a) or n | (a n a ) . Thus, a n a (mod n) for any 1 a n and hence n is Carmichael. 5 Assume n is a Carmichael number. We have already showed n is odd and that n is a product of distinct primes (that is p 2 | n of all primes p that divide n). To show ( p 1) | ( n 1) , we will use the fact that for any prime p, there will always exist an integer a for any prime p where p | a and a p 1 1 (mod p) (Note that p 1 is the smallest exponent that makes this true) Since n is a Carmichael number, we know that a n 1 1 (mod n) . Since p | n , it follows that a n 1 1 (mod p) . Let G gcd( p 1, n 1) . The, there exists integers x and y where ( p 1) x ( n 1) y G or ( p 1) x G ( n 1) y By Fermat’s Little Theorem, we know that a ( p 1) x ( a p 1 ) x (mod p ) (1) x (mod p ) 1 (mod p ) Also a ( p 1) x a G ( n 1) x (mod p ) a G a ( n 1)( x ) (mod p ) a G ( a ( n 1) ) - x (mod p ) a G (1) - x (mod p ) a G (mod p ) Thus, a G 1 (mod p) . Now, we earlier stated that p 1 is the smallest exponent where a p 1 1 (mod p) . Thus, p 1 G . Since G gcd( p 1, n 1) , then G | ( p 1) and G p 1 . Thus G ( p 1) and since G gcd( p 1, n 1) , G | ( n 1) and hence ( p 1) | ( n 1) . This completes the proof. █ 6 Example 1: Determine if 6601 7 23 41 is a Carmichael number. Solution: █ Example 2: Determine if 27347 23 29 41 is a Carmichael number. Solution: █ 7 Note that 227347 20587 2(mod 27347) , which verifies that 27347 is not prime from Example 2. Verifying that Large Integers are Prime The following property is true for all odd prime numbers. Prime Number Property Let p be an odd prime number and write p 1 2k q , where q is an odd positive integer. Choose an integer a where p | a . Then one of the following conditions are true (one or the other) 1. a q 1 (mod p) or 2. One of the numbers a q , a 2 q , a 4 q , …, a 2 the same as ( p 1) (mod p ) . k 1 q is congruent to 1 (mod p ) (which is Proof: █ 8 Taking the contrapositive of the previous property gives us another method for proving that a number p is not prime. Rabin-Miller Test for Composite Numbers Let n be an odd integer and write n 1 2k q where q is an odd positive integer. Then the number n is composite (not prime) if both the following conditions are true: 1. a q 1 (mod n) and 2. None of the numbers a q , a 2 q , a 4 q , …, a 2 is the same as ( p 1) (mod n ) . k 1 q are congruent to 1 (mod n ) (which Notes Concerning the Rabin-Miller Test 1. The base a that proves n is composite is called a Rabin-Miller witness. 2. The test is designed to show that n is not prime. However, there is no types of numbers, like Carmichael numbers that can be used to discourage using Fermat’s Little Theorem to show that a number is prime, to discourage using the Rabin-Miller test to show a number is prime. 3. Although the test cannot be used directly to show a number is prime, its repeated use can be to verify a number is prime to a certain degree of probability. Fact: Given t integer bases a that fail to verify using the Rabin-Miller test that a number n is not prime, then (Probability that n is prime) = 1 (0.75)t Example 3: Determine the approximate number of bases a that we would need to have fail the Rabin-Miller test to show a 99.999 % chance that a given number is prime . █ To demonstrate how the Rabin-Miller test can be applied, we will use Maple.