Definitions: Prime and Composite Primes and Greatest Common Divisors Discrete Mathematics I — MATH/COSC 1056E Julien Dompierre Department of Mathematics and Computer Science Laurentian University Sudbury, October 15, 2008 Eratosthenes Definition A positive integer p greater than 1 is called prime if the only positive factors of p are 1 and p. A positive integer greater than 1 which is not a prime is called composite. Note: An integer n is composite if and only if there exists an integer a such that a | n and 1 < a < n. The primes less than 100 are 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89 and 97. The Sieve of Eratosthenes Born: 276 BC in Cyrene, North Africa (now Shahhat, Libya). Died: 194 BC in Alexandria, Egypt. He was a Greek mathematician, poet, athlete, geographer and astronomer. He was the first person to calculate the circumference of the Earth. www-groups.dcs.st-and.ac.uk/ ~history/Mathematicians/ Eratosthenes.html The sieve of Eratosthenes is used to find the primes not exceeding a specified positive integer. 1 11 21 31 41 51 61 71 81 91 2 12 22 32 42 52 62 72 82 92 3 13 23 33 43 53 63 73 83 93 4 14 24 34 44 54 64 74 84 94 5 15 25 35 45 55 65 75 85 95 6 16 26 36 46 56 66 76 86 96 7 17 27 37 47 57 67 77 87 97 8 18 28 38 48 58 68 78 88 98 9 19 29 39 49 59 69 79 89 99 10 20 30 40 50 60 70 80 90 100 The Sieve of Eratosthenes — 2 The Sieve of Eratosthenes — 3 Integers divisible by 2, other than 2, receive an underline. 1 11 21 31 41 51 61 71 81 91 2 12 22 32 42 52 62 72 82 92 3 13 23 33 43 53 63 73 83 93 4 14 24 34 44 54 64 74 84 94 5 15 25 35 45 55 65 75 85 95 6 16 26 36 46 56 66 76 86 96 7 17 27 37 47 57 67 77 87 97 8 18 28 38 48 58 68 78 88 98 9 19 29 39 49 59 69 79 89 99 10 20 30 40 50 60 70 80 90 100 The Sieve of Eratosthenes — 4 Integers divisible by 3, other than 3, receive an underline. 1 11 21 31 41 51 61 71 81 91 2 12 22 32 42 52 62 72 82 92 3 13 23 33 43 53 63 73 83 93 4 14 24 34 44 54 64 74 84 94 5 15 25 35 45 55 65 75 85 95 6 16 26 36 46 56 66 76 86 96 7 17 27 37 47 57 67 77 87 97 8 18 28 38 48 58 68 78 88 98 9 19 29 39 49 59 69 79 89 99 10 20 30 40 50 60 70 80 90 100 The Sieve of Eratosthenes — 5 Integers divisible by 5, other than 5, receive an underline. Integers divisible by 4, other than 4, receive an underline. This step can be skipped because 4 already has an underline, then 4 is not prime number. Also, all the multiples of 4 have already an underline. 1 11 21 31 41 51 61 71 81 91 2 12 22 32 42 52 62 72 82 92 3 13 23 33 43 53 63 73 83 93 4 14 24 34 44 54 64 74 84 94 5 15 25 35 45 55 65 75 85 95 6 16 26 36 46 56 66 76 86 96 7 17 27 37 47 57 67 77 87 97 8 18 28 38 48 58 68 78 88 98 9 19 29 39 49 59 69 79 89 99 10 20 30 40 50 60 70 80 90 100 The Sieve of Eratosthenes — 6 The Sieve of Eratosthenes — 7 Integers divisible by 7, other than 7, receive an underline. Integers divisible by 6, other than 6, receive an underline. This step can be skipped because 6 already has an underline, then 6 is not prime number. Also, all the multiples of 6 have already an underline. The Sieve of Eratosthenes — 8, 9, 10, 11 1 11 21 31 41 51 61 71 81 91 2 12 22 32 42 52 62 72 82 92 3 13 23 33 43 53 63 73 83 93 4 14 24 34 44 54 64 74 84 94 5 15 25 35 45 55 65 75 85 95 6 16 26 36 46 56 66 76 86 96 7 17 27 37 47 57 67 77 87 97 8 18 28 38 48 58 68 78 88 98 9 19 29 39 49 59 69 79 89 99 10 20 30 40 50 60 70 80 90 100 7 17 27 37 47 57 67 77 87 97 8 18 28 38 48 58 68 78 88 98 9 19 29 39 49 59 69 79 89 99 10 20 30 40 50 60 70 80 90 100 The Sieve of Eratosthenes Red integers are the primes ≤ 100. Integers divisible by 8, 9 and 10, other than 8, 9 and 10, have already an underline and then are not prime and their multiples also have already an underline. Integers divisible by 11, other than 11, receive √ an underline. This step is not mandatory because 11 > 10 = 100. 1 11 21 31 41 51 61 71 81 91 2 12 22 32 42 52 62 72 82 92 3 13 23 33 43 53 63 73 83 93 4 14 24 34 44 54 64 74 84 94 5 15 25 35 45 55 65 75 85 95 6 16 26 36 46 56 66 76 86 96 Three Questions about Primes 1. In the sieve of Eratosthenes, why it is sufficient to stop at 10 to find all the primes not exceeding 100? 2. One can see that when integers get bigger, prime are more sparse. Is there an integer big enough such that there is no more prime past this number? Or is there an infinity of primes? 3. What is the distribution of primes? How fast their occurrence decreases? Theorem Theorem If n is a composite integer, then n has a prime divisor less than or √ equal to n. Remark: The contrapositive of this theorem is: If n has no prime √ divisor less than or equal to n, then n is not a composite integer. The Fundamental Theorem of Arithmetic Theorem (Fundamental Theorem of Arithmetic) Every positive integer greater than 1 can be written uniquely as a prime or as the product two or more primes where the prime factors are written in order of non decreasing size. The primes are the building blocks of positive integers, i.e., any number is composed of primes. The Infinitude of Primes Theorem There are infinitely many primes. Euclid (c. −325 — −265) was the author of the most successful mathematics book ever written. His Elements appeared in over 1000 different editions from ancient to modern times. The proof by contradiction of this theorem come from Euclid’s book. Distribution of Primes Definition: The Greatest Common Divisor Definition Let a and b be integers, not both zero. The largest integer d such that d | a and d | b is called the greatest common divisor of a and b. The greatest common divisor of a and b is denoted by gcd(a, b). Theorem (The Prime Number Theorem) The ratio number of primes not exceeding x x/ ln x approaches 1 as x grows without bound. Definition This theorem was conjectured by Carl Friedrich Gauss and Adrien-Marie Legendre but were not proved. Jacques Hadamard and Charles-Jean-Gustave-Nicholas de la ValleĢe-Poussin proved it in 1896. The integers a and b are relatively prime if their greatest common divisor is 1. gcd and Prime Factorization where each exponent is a non negative integer, and where all primes occurring in the prime factorization of either a or b are included in both factorizations, with zero exponents if necessary. Then gcd(a, b) is given by min(a1 ,b1 ) The integers a1 , a2 , . . . , an are pairwise relatively prime if gcd(ai , aj ) = 1 whenever 1 ≤ i < j ≤ n. Definition: Least Common Multiple Another way to find the greatest common divisor of two integers is to use the prime factorization if these integers. Suppose that the prime factorizations of the integers a and b, neither equal to zero, are a = p1a1 p2a2 · · · pnan , b = p1b1 p2b2 · · · pnbn gcd(a, b) = p1 Definition min(a2 ,b2 ) p2 min(an ,bn ) · · · pn . Definition The least common multiple of the positive integers a and b is the smallest positive integer that is divisible by both a and b. The least common multiple of a and b is denoted by lcm(a, b). lcm and Prime Factorization gcd and lcm Another way to find the least common multiple of two integers is to use the prime factorization if these integers. Suppose that the prime factorizations of the integers a and b, neither equal to zero, are a = p1a1 p2a2 · · · pnan , b = p1b1 p2b2 · · · pnbn where each exponent is a non negative integer, and where all primes occurring in the prime factorization of either a or b are included in both factorizations, with zero exponents if necessary. Then lcm(a, b) is given by max(a1 ,b1 ) lcm(a, b) = p1 max(a2 ,b2 ) p2 max(an ,bn ) · · · pn . Another method to find the lcm(a, b) is to find first the gcd(a, b) and then to use the following theorem: Theorem Let a and b b positive integers. Then ab = gcd(a, b) × lcm(a, b).