Download presentation
Presentation is loading. Please wait.
Published byJean French Modified over 9 years ago
1
강원대학교 컴퓨터과학전공 문양세 이산수학 (Discrete Mathematics) 정수와 나눗셈 (The Integers and Division)
2
Discrete Mathematics by Yang-Sae Moon Page 2 Introduction Of course you already know what the integers are, and what division is… ( 정수와 나누기 … 다 아는거 ~) But: There are some specific notations, terminology, and theorems associated with these concepts which you may not know. ( 몇 가지 주요 표기, 용어, 정리 등을 배웁시다.) These form the basics of number theory. ( 정수론의 기초..) Vital in many important algorithms today (hash functions, cryptography, digital signatures). 2.4 The Integers and Division
3
Discrete Mathematics by Yang-Sae Moon Page 3 Divides, Factor, and Multiple Let a,b Z with a 0. a|b “a divides b” : “ c Z: b=ac” “There is an integer c such that c times a equals b.” (b 가 a 로 나누어짐 (a 로 b 를 나눌 수 있음 ) 을 의미하며, 이때 몫이 c 이다.) Example: 3 12 True, but 3 7 False. Iff a divides b, then we say a is a factor or a divisor of b, and b is a multiple of a. “b is even” : ≡ 2 b. Is 0 even? Is −4? 2.4 The Integers and Division 인수 배수
4
Discrete Mathematics by Yang-Sae Moon Page 4 Some Facts of Division a,b,c Z: 1. a|0 (2|0, 3|0, …) 2. (a|b a|c) a | (b + c) (2|4 2|6 2|10) 3. a|b a|bc (2|4 2|4∙3) 4. (a|b b|c) a|c (2|4 4|8 2|8) Proof of (2): a|b means there is an s such that b=as, and a|c means that there is a t such that c=at, so b+c = as+at = a(s+t), so a|(b+c) also. □ 2.4 The Integers and Division
5
Discrete Mathematics by Yang-Sae Moon Page 5 More Detailed Version of Proof Show a,b,c Z: (a|b a|c) a | (b + c). Let a, b, c be any integers such that a|b and a|c, and show that a | (b + c). By definition of |, we know s: b=as, and t: c=at. Let s, t, be such integers. Then b+c = as + at = a(s+t) so u: b+c=au, namely u=s+t. Thus a|(b+c). 2.4 The Integers and Division
6
Discrete Mathematics by Yang-Sae Moon Page 6 Prime Numbers ( 소수 ) An integer p>1 is prime iff it is not the product of any two integers greater than 1: p>1 a,b N: a>1, b>1, ab=p. The only positive factors of a prime p are 1 and p itself. Some primes: 2,3,5,7,11,13... ( 양의 인수 (divisor) 가 1 과 자기 자신뿐이면 소수 (prime) 라 한다.) Non-prime integers greater than 1 are called composite, because they can be composed by multiplying two integers greater than 1. 2.4 The Integers and Division 합성수
7
Discrete Mathematics by Yang-Sae Moon Page 7 Fundamental Theorem of Arithmetic ( 산술의 기본 정리 ) Every positive integer has a unique representation as the product of a non-decreasing series of zero or more primes. ( 모든 양의 정수는 오름차순으로 정렬된 소수들의 곱으로 유일하게 표현된다. 결국 Prime Factorization( 소인수분해 ) 를 이야기한다고 볼 수 있다.) 1 = (product of empty series) = 1 2 = 2 (product of series with one element 2) 4 = 2·2 (product of series 2,2) 2000 = 2·2·2·2·5·5·5 = 2 4 ·5 3 ; 2001 = 3·23·29; 2002 = 2·7·11·13; 2003 = 2003 2.4 The Integers and Division
8
Discrete Mathematics by Yang-Sae Moon Page 8 소수의 개수 ? “ 무한히 많은 소수가 존재함 ” 을 증명하라. 1. 유한 개의 소수 p 1, p 2, …, p n 이 있다고 가정하자. 2. Q = p 1 ·p 2 ·…·p n + 1 이라 하자. 3. “ 산술의 기본 정리 ” 에 의하여 Q 는 소수들의 곱으로 표현된다. 4. 따라서, p j | Q(1 j n) 를 만족하는 소수 p j 가 존재한다. 5. 그러면, 다음과 같은 전개가 이루어진다. 5.1 (p j | p 1 ·p 2 ·…·p n ) (p j |-(p 1 ·p 2 ·…·p n )) [a|b a|bc] 5.2 (p j | Q) = (p j | (p 1 ·p 2 ·…·p n + 1)) [by step 4] 5.3 (p j | 1)? [(a|b a|c) a | (b + c)] 6. p j 는 1 을 나눌 수 없으므로, 결국 가정 ( 유한 개의 소수가 있다 ) 이 잘못된 것이다. 즉, 소수의 개수는 무한하다. □ 2.4 The Integers and Division
9
Discrete Mathematics by Yang-Sae Moon Page 9 The Division “Algorithm” Really just a theorem, not an algorithm… The name is used here for historical reasons. For any integer dividend a and divisor d≠0, there is a unique integer quotient q and remainder r N such that a = dq + r and 0 r < |d|. dividend = “ 피제수 ”, divisor = “ 제수 ” quotient = “ 몫 ”, remainder = “ 나머지 ” a,d Z, d>0: !q,r Z: 0 r<|d|, a=dq+r. ( ! means “unique”) We can find q and r by: q= a d , r=a qd. (e.g., if a = 14 and d = 3, then q = 14 3 = 4 and r = 14 - 3·4 = 2. 2.4 The Integers and Division
10
Discrete Mathematics by Yang-Sae Moon Page 10 Greatest Common Divisor ( 최대공약수 ) The greatest common divisor gcd(a,b) of integers a,b (not both 0) is the largest (most positive) integer d that is a divisor both of a and of b. ( 최대공약수는 두 수의 공약수 중에서 가장 큰 공약수이다.) d = gcd(a,b) = max(d: d|a d|b) Example: gcd(24,36)=? Positive common divisors: 1,2,3,4,6,12… Greatest is 12. 2.4 The Integers and Division
11
Discrete Mathematics by Yang-Sae Moon Page 11 GCD shortcut If the prime factorizations are written as and, then the GCD is given by: Example: a=84=2·2·3·7 = 2 2 ·3 1 ·7 1 b=96=2·2·2·2·2·3 = 2 5 ·3 1 ·7 0 gcd(84,96) = 2 2 ·3 1 ·7 0 = 2·2·3 = 12. 2.4 The Integers and Division
12
Discrete Mathematics by Yang-Sae Moon Page 12 Relatively Primality ( 서로 소, 상대 소수 ) Integers a and b are called relatively prime or coprime iff their gcd = 1. ( 두 수의 최대공약수가 1 인 경우, 두 수는 서로 소 ( 상대 소수 ) 라 한다.) Example: Neither 21 and 10 are prime, but they are coprime. 21=3·7 and 10=2·5, so they have no common factors > 1, so their gcd = 1. A set of integers {a 1,a 2,…} is (pairwise) relatively prime if all pairs a i, a j, i j, are relatively prime. ( 주어진 정수들의 모든 쌍이 서로 소이면, 해당 정수들은 서로 소라 한다.) E.g., 10, 17, and 21 are relatively primes. 2.4 The Integers and Division
13
Discrete Mathematics by Yang-Sae Moon Page 13 Least Common Multiple ( 최소공배수 ) lcm(a,b) of positive integers a, b, is the smallest positive integer that is a multiple both of a and of b. m = lcm(a,b) = min(m: a|m b|m) ( 최대공배수는 두 수의 공배수 중에서 가장 작은 공배수이다.) E.g. lcm(6,10)=30 If the prime factorizations are written as and, then the LCM is given by 2.4 The Integers and Division
14
Discrete Mathematics by Yang-Sae Moon Page 14 A Useful Rule If a and b are positive integers, then ab = gcd(a,b)·lcm(a,b) Prove it by yourself! 2.4 The Integers and Division
15
Discrete Mathematics by Yang-Sae Moon Page 15 The mod Operator An integer “division remainder” operator. Let a,d Z with d>1, then a mod d denotes the remainder r; i.e. the remainder when a is divided by d. r = a mod d We can compute (a mod d) by: a d· a/d . In C programming language, “%” = mod. 2.4 The Integers and Division q
16
Discrete Mathematics by Yang-Sae Moon Page 16 Modular Congruence ( 모듈로 합동 ?) Let Z + ={n Z | n>0}, the positive integers. Let a,b Z, m Z +. Then a is congruent to b modulo m, written “a b(mod m)”, iff m|(a b). Also equivalent to: (a b) mod m = 0. m 으로 나누었을 때, a 와 b 의 나머지가 동일 ( 합동 ) 하다. m 으로 나누어 나머지가 동일한 수의 차를 m 으로 나누면 나머지가 0 이다. 두 수의 차를 m 으로 나눌 수 있으면, 두 수를 m 으로 나눈 나머지는 동일하다. Also equivalent to: (a b) mod m = 0. Example:17 5(mod 6) 6|(17–5), (17–5)%6 = 0 2.4 The Integers and Division
17
Discrete Mathematics by Yang-Sae Moon Page 17 Spiral Visualization of mod 2.4 The Integers and Division ≡ 3 (mod 5) ≡ 2 (mod 5) ≡ 1 (mod 5) ≡ 0 (mod 5) ≡ 4 (mod 5) 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 Example shown: modulo-5 arithmetic 5 로 나누어 나머지가 3 인 수
18
Discrete Mathematics by Yang-Sae Moon Page 18 Useful Congruence Theorems Let a,b Z, m Z+. Then: a b (mod m) k Z a=b+km. Let a,b,c,d Z, m Z+. Then if a b (mod m) and c d (mod m), then: (a 와 b 가 m 모듈로 합동이고, c 와 d 가 m 모듈로 합동이면,) a+c b+d (mod m), and ac bd (mod m) 2.4 The Integers and Division 나머지 몫
19
Discrete Mathematics by Yang-Sae Moon Page 19 Applications of Congruence ( 합동의 응용 ) The mod operator is widely used in hash functions. h(key) = key mod m Linear congruential methods is used to generate pseudo random numbers. x[n+1] = (a·x[n] + c) mod m Also, in cryptography, encryption, … In C, char shift_three_char(char c) /* assume c is upper */ { return (char)(‘A’ + (c + 3)%26); } 2.4 The Integers and Division
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.