MAT 3930 Primality Test Theorem: (Fermat’s Little Theorem, modified version) Let p be a prime and let a be a number with gcd(a, p) = 1. Then ap ≡ a (mod p) Theorem: (Contrapositive to FlT) Let n be a positive number and let a be a number with gcd(a, n) = 1. If an 6≡ a (mod n) then a is composite. Definition: A composite number n is called a pseudoprime base a if n satisfies an ≡ a (mod n) Definition: A composite number n is called a Charmichael number if it is a pseudoprime with respect to every base a. Definition: Let n be an odd composite number and write n − 1 = 2k q, where q is odd. An integer a satisfying gcd(n, a) = 1 is called a witness for n if both of the following hold: (i) aq 6≡ 1 (mod n) i (ii) a2 q 6≡ −1 (mod n) for 0 ≤ i ≤ k − 1 Theorem: If a is a witness for n, then n is composite. Definition: If a is not a witness for n, then we say n is a strong pseudoprime base a. Theorem: For any odd composite number n, at least 75% of the numbers less than n are witnesses for n. In particular, there are no strong Charmichael numbers. Testing for Primality: Given an odd integer n, check to see if a is a witness for all numbers from 2 to 50. If any of these numbers are witnesses for n, then n is composite. If none of these numbers are witnesses, then there is less than a 1 in 2100 chance that the number is prime. We say that n is a probable prime, and most people in the world would be willing to bet that n is prime.