1 Section 3.4 The Integers and Division Definition If a and b are integers with a 6= 0, we say that a divides b if there is an integer k such that b = ak. When a divides b, we say that a is a factor or divisor of b and that b is a multiple of a. The notation a | b denotes that a divides b. We write a - b when a does not divide b. Example 1 3 | 12 and 4 - 7. Example 2 Let n and d be positive integers. How many positive integers not exceeding n are divisible by d? Example 3 Suppose a | b and b | a. What can you say about a and b? Theorem 1 Let a, b, and c be integers. Then 1. if a | b and a | c, then a | b + c. 2. if a | b, then a | nb for all integers n. 3. if a | b and b | c, then a | c. Proof Corollary If a, b, and c are integers such that a | b and a | c, then a | mb + nc. Theorem 2 (Division Algorithm) Let a be an integer and d a positive integer. Then there are unique integers q and r, with 0 ≤ r < d, such that a = dq + r. In this case, we say that q is the quotient and r is the remainder. Example 4 Verify Theorem 2 above using (a, d) = (10, 3), (−17, 5), and (60, 12). 2 Definition If a and b are integers and m is a positive integer, then a is said to be congruent to b modulo m if m divides a − b. We use the notation a ≡ b (mod m) to indicate that a is congruent to b modulo m. If a and b are not congruent modulo m, we write a 6≡ b (mod m). Remark a ≡ b (mod m) if and only if there is k ∈ Z such that a − b = km. Example 5 12 ≡ 5 (mod 7) but 24 6≡ 14 (mod 6). a ≡ a (mod m) for any a ∈ Z and m ∈ Z+ . Example 6 March 1, 2012 is Thursday and therefore we know that March 22, 2012 is also Thursday. Why? Example 7 If a ≡ b (mod m), then b ≡ a (mod m). Example 8 Show that a ≡ b (mod m) and b ≡ c (mod m), then a ≡ c (mod m). Theorem 3 Let m be a positive integer. If a ≡ b (mod m) and c ≡ d (mod m), then a + c ≡ b + d (mod m) and ac ≡ bd (mod m). Proof 3 Section 3.5 Primes and Greatest Common Divisors 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 that is greater than 1 and is not prime is called composite. Remark If n is composite, then there exist integers a, b such that n = ab with 1 < a < n and 1 < b < n. Theorem 1 (The Fundamental Theorem of Arithmetic) Every positive integer greater than 1 can be written uniquely as a prime or as the product of two or more primes where the prime factors are written in order of nondecreasing size. Example 1 180 = 6 · 30 = (2 · 3) · (3 · 10) = (2 · 3) · (3 · 2 · 5) = 22 · 32 · 5. The last expression is called the prime factorization of 180. Example 2 Find the prime factorization of 10! = 1 · 2 · 3 · · · · · 10. Example 3 Let 2a · 3b · 5c · · · · be the prime factorization of 100!. 1. Determine a, b, and c. 2. How many zeros does 100! have in the end? Definition For a positive integer n, let d(n) denote the number of positive divisors. Example 4 Since positive divisors of 6 are 1, 2, 3, or 6, we get d(6) = 4. For any prime p, d(p) = 2. Example 5 Find d(180). Find d(10!). 4 Example 6 There are 100 light bulbs lined up in a row in a room. Each bulb has its own switch and is currently switched off. The room has an entry door and an exit door. There are 100 people lined up outside the entry door. Each bulb is numbered consecutively from 1 to 100. So is each person. Person No. 1 enters the room, switches on every bulb, and exits. Person No. 2 enters and flips the switch on every second bulb (turning off bulbs 2, 4, 6, · · · ). Person No. 3 enters and flips the switch on every third bulb (changing the state on bulbs 3, 6, 9, ). This continues until all 100 people have passed through the room. How many of the light bulbs are illuminated after the 100th person has passed through the room? Determining whether given number is prime is important in many applications (such as cryptography), and the following theorem provides a useful criterion. Theorem 2 If n is a composite integer, then n must have a prime factor less than or equal to √ n. Example 7 Show that 2011 is prime. 5 Theorem 3 There are infinitely many primes. Some Open Questions about Primes 1. Goldbach’s Conjecture Can every even integer greater than 2 be written as the sum of two primes? It is true up to 2 × 1017 . 2. Twin Prime Conjecture Twin primes are primes that differ by 2, such as 3 and 5, 5 and 7, 11 and 13, and 17 and 19. Do we have infinitely many twin primes? The largest twin primes known so far are 16, 869, 987, 339, 975 × 2171,960 ± 1. 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). The integers a and b are relatively prime (or coprime) if gcd(a, b) = 1. Example 8 gcd(24, 36) = . 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). Example 9 What is lcm(23 · 35 · 72 , 24 · 33 )? Remark Let pk denote the kth prime number so that p1 = 2, p2 = 3, p3 = 5, and so on. 1. By the Fundamental Theorem of Arithmetic, for every positive integer a, we can find an n and natural numbers ek ’s such that a = pe11 pe22 pe33 · · · penn . 2. a = pe11 pe22 pe33 · · · penn and b = pf11 pf22 pf33 · · · pfmm be positive integers. Taking the zeroth power if necessary, we can assume that m = n. Then min{e1 ,f1 } min{e2 ,f2 } min{e3 ,f3 } p2 p3 gcd(a, b) = p1 · · · pnmin{en ,fn } and max{e1 ,f1 } max{e2 ,f2 } max{e3 ,f3 } p2 p3 lcm(a, b) = p1 3. In particular, we get ab = gcd(a, b) · lcm(a, b). n ,fn } · · · pmax{e . n 6 Section 3.6 Integers and Algorithms In everyday life, we use decimal notation to express integers. For example 217 is used to denote 2 · 102 + 1 · 101 + 7 · 100 . It is often convenient to use bases other than 10. For example, we can express 217 using base 5, that is, 217 = 1 · 53 + 3 · 52 + 3 · 51 + 2 · 50 . In general, we have the following: Theorem 1 Let b be a positive integer greater than 1. Then if n is a positive integer, it can be expressed uniquely in the form n = ak bk + ak−1 bk−1 + · · · + a1 b + a0 , (∗) where k is a nonnegative integer, a0 , a1 , . . . , ak are nonnegative integers less than b, and ak 6= 0. Definition 1. The representation in (∗) is called the base b expansion of n and denoted by (ak ak−1 . . . a1 a0 )b . 2. The base 10 expansion is also called the decimal expansion and we usually write ak ak−1 . . . a1 a0 instead of (ak ak−1 . . . a1 a0 )10 . The base 2 expansion is called the binary expansion, the base 8 is called the octal expansion, and the base 16 is called the hexadecimal expansion. 3. To represent a number using the hexadecimal expansion, sixteen different digits are required. Usually, the hexadecimal digits used are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F , where A corresponds to decimal number 10, B to 11,. . . , F to 15. Example 1 The decimal notation 217 equals (1332)5 . Example 2 Find the decimal expansion of each of the following: 1. (101011111)2 2. (A8F 4)16 3. (3061)8 Remark There are only 10 types of people in the world: those who understand binary expansion, and those who don’t. 7 Example 3 We now describe a procedure for constructing base b expansion of an integer n. To illustrate the procedure, we will find the octal (i.e., base 8) expansion of 12345. First we note that 82 = 64, 83 = 512, 84 = 4096, 85 = 32768, ... so it is sufficient to determine a, b, c, d, e such that 12345 = a · 84 + b · 83 + c · 82 + d · 8 + e with 0 ≤ a, b, c, d, e ≤ 7. We start with e. Recall that if n is an integer and s is a positive integer, then there are unique integers q and r, with 0 ≤ r < s, such that n = sq + r. Apply this to n = 12345 and s = 8, then it follows that 12345 = 8(a · 83 + b · 82 + c · 8 + d) + e, that is, e is the remainder when 12345 is divided by 8. Indeed, 12345 = 8 · 1543 + 1, so a · 83 + b · 82 + c · 8 + d = 1543 and e = 1. Now to get d, we repeat this process with n = 1543. That is, 1543 = 8 · 192 + 7, so a · 82 + b · 8 + c = 192 and d = 7. Similarly, 192 = 8 · 24 + 0 gives a · 8 + b = 24 and c = 0, Finally 24 = 8 · 3 + 0 gives a = 3 and b = 0, so we get 12345 = (30071)8 . Example 4 Find the base 5 expansion of 167. Example 5 Convert (201)5 from its base 5 expansion to its binary expansion. 8 Example 6 On the shelf you have 10 identical bottles of identical pills (let’s say there are more than one thousand pills in each bottle). However, one of those 10 bottles contains cheap knockoff pills. The only way to differentiate fake pills from real pills is the weight - while real pills weigh 1 gram each, the fake pills are 2 grams. You have one scale that shows the exact weight (down to the gram) of whatever is weighed. How can you tell which bottle contains fake pills with just 1 weighing? Example 7 The same situation as above. However, this time, we do not know how many bottles contain fake pills. How can you tell which bottles contain fake pills with just 1 weighing? Example 8 Number guessing (slides). 9 We close this section with the Euclidean algorithm, which is used to find the greatest common divisor of a given pair of integers. Euclidean algorithm Let a = bq + r, where a, b, q, and r are integers. Then gcd(a, b) = gcd(b, r). Proof Example 9 Find the greatest common divisor of 414 and 662 using the Euclidean algorithm. Example 10 Show that 1694 and 975 are relatively prime. 10 Section 3.7 Applications of Number Theory In the previous section, we learned Euclidean algorithm. In this section, we begin with its consequences. Theorem 1 If a and b are positive integers, then there exist integers s and t such that gcd(a, b) = sa+tb. In particular, if a, b are relatively prime, then there exist integers s and t such that 1 = sa+tb. Example 1 1. Find gcd(252, 198). 2. Express the greatest common divisor as s · 252 + t · 198. Theorem 2 Let a, b, and c be positive integers. 1. If a | c, b | c, and gcd(a, b) = 1, then ab | c. 2. if a | bc and gcd(a, b) = 1, then a | c. 3. Let p be a prime and p | ab. Then p | a or p | b. In general, if p | a1 a2 · · · an , where each ai is an integer, then p | ai for some i. Proof 11 We learned that if a ≡ b (mod m), then ca ≡ cb (mod m) for any integer c. Now suppose that ca ≡ cb (mod m). Does it follow that a ≡ b (mod m)? Example 2 14 ≡ 8 (mod 6), but 7 6≡ 4 (mod 6). Theorem 3 Let m be a positive integer and let a, b, and c be integers. If ca ≡ cb (mod m) and gcd(c, m) = 1, then a ≡ b (mod m). Proof Fermat’s Little Theorem If p is a prime and a is an integer not divisible by p, then ap−1 ≡ 1 (mod p). Furthermore, for every integer a we have ap ≡ a (mod p). Proof Assume that a is not divisible by p. Consider the set S = {a, 2a, 3a, . . . , (p − 1)a}. Claim 1: No two elements of S are congruent modulo p. Proof of Claim 1 From Claim 1 above, it follows that each element in S is congruent to a different number from 1 to p − 1. Therefore we have a · 2a · · · · · (p − 1)a ≡ 1 · 2 · · · · · (p − 1) (mod p). In other words, (p − 1)!ap−1 ≡ (p − 1)! (mod p). 12 Claim 2: p - (p − 1)!, that is, gcd(p, (p − 1)!) = 1. Proof of Claim 2 From Claim 2 and Theorem 3, it follows that ap−1 ≡ 1 (mod p). Now we want to show that ap ≡ a (mod p) for every a. Indeed, if a is not divisible by p, then the previous result can be applied. If a is a multiple of p, then so is ap −a = a(ap−1 −1) and the result follows. Example 3 What is the remainder when 2340 is divided by 11? Example 4 Find the remainder when 3302 is divided by 1. 5 2. 7 3. 11 Example 5 Find the remainder when 3987654321234567890 is divided by 5. 13 Remark Fermat’s Little Theorem can be extended to more general case. Euler’s Theorem Let a and n be positive integers with gcd(a, n) = 1. Then aφ(n) ≡ 1 (mod n), where φ is Euler’s φ-function defined by φ(n) = the number of positive integers less than or equal to n that are relatively prime to n. In particular, Fermat’s Little Theorem follows from Euler’s Theorem since φ(p) = p − 1 for any prime p. Theorem 4 Let p and q be distinct primes and a be a positive integer such that gcd(a, p) = gcd(a, q) = 1. Then a(p−1)(q−1) ≡ 1 (mod pq)