180 likes | 405 Views
Discrete Mathematics. University of Jazeera College of Information Technology & Design Khulood Ghazal. The Integers and Division. The Integers and Division. • Of course, you already know what the integers are, and what division is…
E N D
Discrete Mathematics University of Jazeera College of Information Technology & Design Khulood Ghazal The Integers and Division
The Integers and Division • 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).
Why prime numbers? • Prime numbers are not well understood • Basis for today’s cryptography • Unless otherwise indicated, we are only talking about positive integers for this lecture.
The Divides operator • • Let a and b are integers with a≠0. • • Definition: a | b≡ “a divides b” :≡ (b=a*c) • “There is an integer c such that c times a equals b.” • – Example: 3|−12 ⇔ True, but 3|7 ⇔ False. • • If a divides b, then we say a is a factor of b or a divisor of b, and 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: Determine whether 3|7 and whether 3|12 • 3 | 7 since 7/3 is not integer. • 3|12 since 12/3 is integer.
Theorem on the Divides operator • If a | b and a | c, then a | (b + c) • (a | b ∧ a | c) → a | (b + c) • Example: if 5 | 25 and 5 | 30, then 5 | (25+30) • If a | b, then a | b*c for all integers c • a |b → a |b *c • Example: if 5 | 25, then 5 | 25*c for all integers c • If a | b and b | c, then a | c • (a | b ∧ b | c) → a | c • Example: if 5 | 25 and 25 | 100, then 5 | 100
Prime numbers • An integer p>1 is prime iff it is not the product of two integers greater than 1: • • The only positive factors of a prime p are 1 and p itself. • Some primes: 2,3,5,7,11,13... • • Non-prime integers greater than 1 are called composite, because they can be composed by multiplying two integers greater than 1. • Note that 1 is not prime! • It’s not composite either – it’s in its own class.
The Fundamental Theorem of Arithmetic • Every positive integer greater than 1 can be uniquely written as a prime or as the product of two or more primes where the prime factors are written in order of increasing size. • Examples: The prime factorization of: • 100 = 2 * 2 * 5 * 5 • 182 = 2 * 7 * 13 • 29820 = 2 * 2 * 3 * 5 * 7 * 71
Composite factors • If n is a composite integer, then n has a prime divisor less than or equal to the square root of n (n) . • Check if 113 is composite or prime. • Solution • The only prime factors less than 113 = 10.63 are 2, 3, 5, and 7 • Neither of these divide 113 evenly • Thus, by the fundamental theorem of arithmetic, 113 must be prime
Showing a number is composite • Show that 899 is composite. • Solution • Divide 899 by successively larger primes, starting with 2 • We find that 29 and 31 divide 899
The Division “Algorithm” It’s really just a theorem, not an algorithm… • Theorem: let a be an integer and d divisor d≠0 .Then there is a unique integer quotient q and remainder r such that a = d*q + r and 0 ≤ r < |d|. Formally, the theorem is: 0≤r<|d|, a=d*q + r. Example: what are the quotient and remainder when 101 is divided by 11? 101=11*9 +2
Greatest Common Divisor • The greatest common divisor of two integers a and b is the largest integer d such that d | a and d | b • Denoted by gcd(a,b) • d = gcd(a , b) = max(d: d|a ∧ d|b) • Examples • gcd (24, 36) = 12 • gcd (17, 22) = 1 • gcd (100, 17) = 1 Example: gcd(24,36)=? Positive common divisors of 24 and 36 are: 1,2,3,4,6,12. The largest one of these is 12.
More on gcd’s • Given two numbers a and b, rewrite them as: • Example: gcd (120, 500) • 120 = 23*3*5 = 23*31*51 • 500 = 22*53 = 22*30*53 • Then compute the gcd by the following formula: • gcd(120,500) = 2min(3,2)3min(1,0)5min(1,3) = 223051 = 20. • Example: gcd(84,96) • 84=2 * 2 * 3 * 7 = 22 * 31*71 • 96=2・2・2・2・2・3 = 25* 31* 70 • gcd(84,96) = 22 * 31* 70= 12.
Relative primes • Two numbers are relatively prime if they don’t have any common factors (other than 1) • Rephrased: a and b are relatively prime if gcd (a,b) = 1 • gcd (25, 39) = 1, so 25 and 39 are relatively prime
Pairwise relative prime • A set of integers a1, a2, … an are pairwise relatively prime if, for all pairs of numbers, they are relatively prime • Formally: The integers a1, a2, … an are pairwise relatively prime if gcd(ai, aj) = 1 whenever 1 ≤ i < j ≤ n. • Example: are 10, 17, and 21 pairwise relatively prime? • gcd(10,17) = 1, gcd (17, 21) = 1, and gcd (21, 10) = 1 • Thus, they are pairwise relatively prime • Example: are 10, 19, and 24 pairwise relatively prime? • Since gcd(10,24) ≠ 1, they are not
Least Common multiple • The least common multiple of the positive integers a and b is the smallest positive integer that is divisible by both a and b. • Denoted by lcm (a, b) • Example: lcm(10, 25) = 50 • What is lcm (95256, 432)? • 95256 = 233572, 432=2433 • lcm (233572, 2433) = 2max(3,4)3max(5,3)7max(2,0) • = 243572 = 190512
lcm and gcd Theorem • Let a and b be positive integers. Then a*b = gcd(a , b) * lcm (a, b) • Example: gcd (10,25) = 5, lcm (10,25) = 50 • 10*25 = 5*50 • Example: gcd (95256, 432) = 216, lcm (95256, 432) = 190512 • 95256*432 = 216*190512
The mod operator An integer “division remainder” operator. • Let a , d with d>1. Then a mod d denotes the remainder r from the division “algorithm” with dividend a and divisor d; i.e. the remainder when a is divided by d. – Using e.g. long division. Note: See class notes for Examples .