Sets, Combinatorics, Probability, and Number Theory Mathematical Structures for Computer Science Chapter 3 Copyright © 2006 W.H. Freeman & Co.MSCS Slides Probability
Section 3.7Number Theory1 Fundamental Theorem of Arithmetic FUNDAMENTAL THEOREM OF ARITHMETIC For every integer n 2, n is a prime number or can be written uniquely (ignoring ordering) as a product of prime numbers. We ignore the order in which we write the factors: 2(3)(3) = 3(2)(3) If a and b are positive integers, then gcd(a,b) can always be written as a linear combination of a and b, that is, gcd(a,b) = ia + jb for some integers i and j. gcd(420,66) = 6 = 3(420) 19(66)
Section 3.7Number Theory2 Fundamental Theorem of Arithmetic The values 3 and 19 in gcd(420,66) = 3(420) 19(66) are derived from the successive divisions done by the Euclidean algorithm: 420 = 6 * = 2 * = 1 * = 3 * Rewriting the first three equations from the bottom up: 6 = 24 * = 66 * = 420 * Now we use these equations in a series of substitutions: 6 = 24 1 * 18 = 24 1 * (66 2 * 24) (substituting for 18) = 3 * 24 66 = 3 * (420 6 * 66) 66 (substituting for 24) = 3 * 420 19 * 66
Section 3.7Number Theory3 Fundamental Theorem of Arithmetic THEOREM ON gcd(a, b) Given positive integers a and b, gcd(a,b) is the linear combination of a and b that has the smallest positive value. From the theorem on gcd(a,b), it follows that a and b are relatively prime if and only if there exist integers i and j such that: ia + jb = 1 DEFINITION: RELATIVELY PRIME Two integers a and b are relatively prime if gcd(a,b) 1.
Section 3.7Number Theory4 Fundamental Theorem of Arithmetic THEOREM ON DIVISION BY PRIME NUMBERS Let p be a prime number such that p ab, where a and b are integers. Then, either p a or p b. To find the unique factorization of 825 as a product of primes, we can start by simply dividing 825 by successively larger primes: 825 = 3 * 275 = 3 * 5 * 55 = 3 * 5 * 5 * 11 = 3 * 5 2 * 11 Doing the same on 455: 455 = 5 * 7 * 13 From these factorizations, we can see that gcd(825, 455) = 5.
Section 3.7Number Theory5 More on Prime Numbers THEOREM ON SIZE OF PRIME FACTORS If n is a composite number, then it has a prime factor less than or equal to (n) 1/2. Given n = 1021, let’s find the prime factors of n or determine that n is prime. The value of (1021) 1/2 is just less than 32. So the primes we need to test are 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31. None divides 1021, so 1021 is prime.
Section 3.7Number Theory6 More on Prime Numbers THEOREM ON INFINITY OF PRIMES (EUCLID) There is an infinite number of prime numbers. Assume that there is a finite number of primes. Let the value of s = the sum of all primes + 1. Therefore, s is not prime. Thus, s is composite and by the fundamental theorem of arithmetic, s can be factored as a product of (some of) the prime numbers. Suppose that p j is one of the prime factors of s, that is, s = p j (m) for some integer m. Then: 1 = s – p 1 p 2 … p k = p j (m) p 1 p 2 … p k = p j (m p 1 … p j 1 p j + 1 …p k ) Therefore, p j 1, which is a contradiction.
Section 3.7Number Theory7 Euler Phi Function DEFINITION: EULER PHI FUNCTION For n an integer, n 2, the Euler (pronounced “oiler”) phi function of n, (n), is the number of positive integers less than or equal to n and relatively prime to n. ( (n) is pronounced “fee” of n.) For example: (2) = 1 (the number 1) (3) = 2 (the numbers 1, 2) (4) = 2 (the numbers 1, 3) (5) = 4 (the numbers 1, 2, 3, 4) (6) = 2 (the numbers 1, 5) (7) = 6 (the numbers 1, 2, 3, 4, 5, 6)