Presentation is loading. Please wait.

Presentation is loading. Please wait.

Number Theory 이재원 School of Information Technology Sungshin W. University.

Similar presentations


Presentation on theme: "Number Theory 이재원 School of Information Technology Sungshin W. University."— Presentation transcript:

1 Number Theory 이재원 School of Information Technology Sungshin W. University

2 Division DEFINITION 1 If a and b are integers with a≠0, we say that a divides b if there is an integer c such that b=ac. When a divides b we say that a is a factor 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. ex) 3 ł 7, 3|12

3 Division Cont. THEOREM 1 Let a, b, and c be integers. Then (i) if a | b and a | c, then a | (b + c); (ii) if a | b and a | bc, for all integers c; (iii) if a | b and b | c, then a | c. COROLLARY 1 If a, b, and c are integers such that a | b and a | c then a | mb + nc whenever m and n are integers.

4 Division Cont. THE 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. THEOREM 2 In the equality given in the division algorithm, d is called the divisor, a is called the dividend, q is called the quotient, and r is called the remainder. q = a div d, r = a mod d. (101/11?, -11/3?)

5 Modular Arithmetic DEFINITION 3 If a and b are integers and m is a positive integer, then a is congruent to b modulo m if m divides a – b. a  b (mod m) THEOREM 3 Let a and b be and let m be a positive integer, then a  b (mod m) if and only if a mod m = b mod m. 17  5 (mod 6) ? Yes. 24  14 (mod 6) ? No.

6 Modular Arithmetic Cont. THEOREM 4 Let m be a positive integer. The integer a and b are congruent modulo m if and only if there is an integer k such that a = b + km THEOREM 5 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). ex) 7  2 (mod 5) and 11  1 (mod 5) => 18  3 (mod 5) and 77  2 (mod 5)

7 Modular Arithmetic Cont. COROLLARY 2 Let m be a positive integer and let a and b are integers. Then, (a + b) mod m = ((a mod m) + (b mod m)) mod m and ab mod m = ((a mod m)(b mod m)) mod m Proof) a  (a mod m) (mod m) and b  (b mod m) (mod m) -> a + b  (a mod m) + (b mod m) (mod m) …

8 Applications of Congruences Hashing Functions h(k) = k mod m Pseudorandom Numbers x n+1 = (ax n + c) mod m Ex) if we choose m=9, a=7, c=4, and x 0 =3, we get 3, 7, 8, 6, 1, 2, 0, 4, 5, 3, 7, 8, 6, …

9 Applications of Congruences Cryptology Caesar’s encryption: f (p) = (p + 3) mod m EXAMPLE 9 secret message from “MEET YOU IN THE PARK” using Caesar’s cipher? 12 4 4 19 24 14 20 8 13 19 7 4 15 0 17 10 15 7 7 22 1 17 23 11 16 22 10 7 18 3 21 13 “PHHW BRX LQ WKH SUDN” enhancing security: f (p) = (ap + b) mod 26

10 Primes and GCDs DEFINITION 1 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. 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.

11 Primes and GCDs THEOREM 2 If n is a composite integer, then n has a prime divisor less than or equal to. EXAMPLE 3 Show that 101 is prime. Solution: The only primes not exceeding are 2, 3, 5, and 7. … EXAMPLE 4 Find the prime factorization of 7007. 7007/7 = 1001, 1001/7 = 143, … 7007 = 7 2 ·11·13

12 Representation of Integers 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= a k b k + a k-1 b k-1 + … + a 1 b 1 + a 0 Where k is a nonnegative integer, a 0, a 1, …, a k are nonnegative integers less than b and a k ≠ 0.

13 Cont. The representation of n given in Theorem 1 is called base b expansion of n. The base b expansion of n is denoted by (a k a k-1 …a 1 a 0 ) b For instance, (245) 8 represents 2·8 2 + 4·8 + 5 = 165.

14 Cont. Example 1 What is the decimal expansion of the integer that has (1 0101 1111) 2 as its binary expansion? Solution: (1 0101 1111) 2 = 1·2 8 + 0·2 7 + 1·2 6 + 0·2 5 + 1·2 4 + 1·2 3 + 1·2 2 + 1·2 1 + 1·2 0 = 351.

15 Cont. Example 3 Find the base 8, or octal, expansion of (12345) 10. Solution: 12345 = 8·1543 + 1. 1543 = 8·192 + 7. 192 = 8·24 + 0. 24 = 8·3 + 0. 3 = 8·0 + 3. (12345) 10 = (30071) 8

16 Modular Exponentiation Example 11 Find 3 644 mod 645. Solution: - 644 를 2 진수로 표현하면 (1010000100) 2 이다. 따 라서 644 = 2 9 + 2 7 + 2 2 이며, 3 644 = (3 의 2 9 승 ) · (3 의 2 7 승 ) · (3 의 2 2 승 ) 이다. - 세 수의 곱을 645 로 나눈 나머지는 각각의 수를 644 로 나눈 나머지들을 모두 곱한 후 다시 645 로 나눈 나머지와 같다 ( 교재 205 페이지의 따름정리 (corollary) 2 참고 ). - 이 원리를 이용하여 만들어진 알고리즘 5 에 의해,

17 Modular Exponentiation Cont. i=0: a 0 =0, x=1, p=3 2 mod 645 = 9 mod 645 = 9; i=1: a 1 =0, x=1, p=9 2 mod 645 = 81 mod 645 = 81 (3 의 2 2 승 ); i=2: a 2 =1, x=(1·81) mod 645 = 81, p=81 2 mod 645 = 6561 mod 645 = 111; ( (6561 · 6561) mod 645 = (111 · 111) mod 645 ) i=3: a 3 =0, x=81, p=111 2 mod 645 = 12,321 mod 645 = 66; i=4: a 4 =0, x=81, p=66 2 mod 645 = 4356 mod 645 = 486; i=5: a 5 =0, x=81, p=486 2 mod 645 = 236,196 mod 645 = 126; i=6: a 6 =0, x=81, p=126 2 mod 645 = 15,876 mod 645 = 396; i=7: a 7 =1, x=(81·396) mod 645 = 471, p=396 2 mod 645 = 156,816 mod 645 = 81; i=8: a 8 =0, x=471, p=81 2 mod 645 = 6561 mod 645 = 111; i=9: a 9 =1, x=(471·111) mod 645 = 52,281 mod 645 = 36.

18 Modular Exponentiation Cont. ALGORITHM 5 Modular Exponentiation Procedure modular exponentiation(b: integer, n = (a k-1 a k-2, …, a 1 a 0 ) 2, m: positive integer) x := 1 power := b mod m for i = 0 to k -1 begin if a i = 1 then x := (x · power) mod m power := (power · power) mod m end (x equals b n mod m)

19 The Euclidean Algorithm More efficient method of finding the greatest common divisor Finding gcd(91, 287) - 287 = 91 · 3 + 14 - any divisor of 91 and 287 must also be a divisor of 287 - 91 · 3 = 14. Also, any divisor of 91 and 14 must also be a divisor of 287 = 91 · 3 + 14. - Hence, the greatest common divisor of 91 and 287 is the same as the greatest common divisor of 91 and 14.

20 The Euclidean Algorithm Cont. - This means that the problem of finding gcd(91, 287) has been reduced to the problem of finding gcd(91, 14). - Next, divide 91 by 14 to obtain - 91 = 14 · 6 + 7 - Continue by dividing 14 by 7(gcd(91, 14) = gcd(14, 7)) - 14 = 7 · 2 - Because 7 divides 14, it follows that gcd(14, 7) = 7. Furthermore, because gcd(287, 91) = gcd (91, 14) …, the original problem has been solved.

21 The Euclidean Algorithm Cont. LEMMA 1 Let a = bq + r, where a, b, q, and r are integers. Then gcd(a, b) = gcd(b, r). Proof: Suppose that d divides both a and b. Then d also divides a – bq = r (from Theorem 1 of section 3.4). Hence, any common divisor of a and b is also a common divisor of b and r. Likewise, suppose that d divides both b and r. Then d also divides bq + r = a. Hence, any common divisor of b and r is also a common divisor of a and b. => gcd(a, b) = gcd(b, r)

22 The Euclidean Algorithm Cont. EXAMPLE 12 Find the greatest common divisor of 414 and 662. Solution: Successive uses of the division algorithm give: 662 = 414 · 1 + 448 414 = 248 · 1 + 166 248 = 166 · 1 + 82 166 = 82 · 2 + 2 82 = 2 · 41. Hence, gcd(414, 662) = 2, because 2 is the last nonzero remainder.

23 The Euclidean Algorithm Cont. ALGORITHM 6 The Euclidean Algorithm Procedure gcd(a, b: positive integers) x := a y := b while y ≠ 0 begin r := x mod y x := y y := r end (gcd(a, b) is x)


Download ppt "Number Theory 이재원 School of Information Technology Sungshin W. University."

Similar presentations


Ads by Google