Download presentation

Presentation is loading. Please wait.

Published byDominick Parker Modified over 2 years ago

1
The Integers and Division

2
Outline Division: Factors, multiples Exercise 2.3 Primes: The Fundamental Theorem of Arithmetic. The Division Algorithm Greatest Common Divisors: Relatively prime Least Common Multiples Modular Arithmetic: Congruence Applications of Congruence: Cryptology

3
Division Definition Let a and b be integers with a 0. Then, we say that a divides b (and we note a | b) if there is an integer c such that b = ac. –a is called a factor of b, and b is multiple of a. –We note a ¬| b when a does not divide b I used above notation for lack of strike vertical in PP. –Examples 3 | 12, but 3 ¬| 14 –Note P(a, b): a | b is a predicate, with values True or False. Theorem Let a, b, c be integers with a 0. Then, –if a | b and a | c, then a | (b+c); –if a | b, then a | bc; –if a | b and b | c, then a | c.

4
Exercise 2.3a

5
Primes 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. –Examples 7 is prime. 9 is composite. –Note 1 is not prime, nor composite. –Some primes: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47… The Fundamental Theorem of Arithmetic Every positive integer can be written uniquely as the product of primes, in increasing order. –Examples. 100 = 2 2 5 2, 641 = 641, 999 = 3 3 37, and 1024 = 2 10.

6
Primes – Cont. Theorem If n is a composite integer, then n has a prime divisor less than or equal to n. An integer n is prime if it is not divisible by any prime less than or equal to n. –101 is prime, since 101 is not divisible by 2, 3, 5, or 7 (the only primes less or equal than 101.) Prime factorization of 7007: –Divide 7007 by primes, starting with 2, 3, 7… 7007/7 = 1001. –Divide 1001 by primes, starting with 7… 1001/7 = 143. –Divide 143 by primes, starting with 7… 143/11 = 13. –Stop, since 13 is prime. 7007 = 7 2 11 13

7
The Division Algorithm 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. –d is called the divisor, –a is called the dividend, –q is called the quotient, –r is called the reminder. –Examples 101 = 11 9 + 2. How about: 101 = 11 8 + 13? -11 = 3(-4) + 1. How about: -11 = 3(-3) - 2?

8
Greatest Common Divisors Definition Let a and b be integers, not both zero. The largest integer d such that d | a and d | b, denoted by gcd(a, b), is called the greatest common divisor of a and b. –Examples gcd(24, 36) = 12. gcd(17, 22) = 1.

9
Greatest Common Divisors -Cont Procedure to find gcd(a, b): –Find the prime factorization of a and b. –If a = p 1 a 1 p 2 a 2 … p n a n, b = p 1 b 1 p 2 b 2 … p n b n, then gcd(a, b) = p 1 min(a 1,b 1 ) p 2 min(a 2,b 2 ) … p n min(a n,b n ) –Examples 120 = 2 3 3 5 and 500 = 2 2 5 3 = 2 2 3 0 5 3 gcd(120, 500) = 2 2 3 0 5 1 = 20.

10
Relatively Prime Integers Definition The integers a and b are relatively prime if gcd(a, b) = 1. –Example 17 and 22 are relatively prime. Definition The integers a 1, a 2, …, a n are pairwise relatively prime if gcd(a i, a j )=1 whenever 1 i

11
Least Common Multiples Definition Let a and b be positive integers. The least common multiple of a and b is the smallest positive integer that is divisible by both a and b. It is denoted by lcm(a, b). –If a = p 1 a 1 p 2 a 2 … p n a n, b = p 1 b 1 p 2 b 2 … p n b n, then lcm(a, b) = p 1 max(a 1,b 1 ) p 2 max(a 2,b 2 ) … p n max(a n,b n ) –Example lcm(2 3 3 5 7 2, 2 4 3 3 ) = 2 4 3 5 7 2. Theorem a + b + ab = gcd(a, b) lcm(a, b)

12
Modular Arithmetic Definition Let a be an integer and m a positive integer. a mod m denotes the reminder when a is divided by m. –a mod m = r, where 0 r < m and a = qm + r. –Examples 17 mod 5 = 2 (since 17 = 3 5 + 2.) -133 mod 9 = 2 2001 mod 101 = 82 –The function f m : Z → {0, 1, 2, …, m-1}, where f m (a) = a mod m is onto, but not one-to-one.

13
Congruence Definition If a and b are integers and m a positive integer, then a is congruent to b modulo m (a b (mod m)) if m divides (a – b). –Note a b (mod m) a mod m = b mod m –Examples 17 5 (mod 6), since 17-5 = 12 = 6 2 is a multiple of 6. Note also that 17 mod 6 = 5 mod 6 = 5. 24 ¬ 14 (mod 6) I used above notation for lack of strike in PP.

14
Congruence – Cont. Theorem m Z + a Z b Z a b (mod m) k Z a = b + km Theorem If a b (mod m) and c d (mod m), then: a+c b+d (mod m), and ac bd (mod m).

15
Applications of Congruence Hashing Functions Pseudorandom Numbers –Linear congruential method Cryptology –Caesar cipher

16
Hashing Functions Records are identified by a key (integer k). –For example, using Social Security number To record k, assign memory location –h(k) = k mod m, where m is the number of available memory locations. h(k) is easily evaluated; it is also onto. Example. If m=111, the record with k=064212848 is assigned to location 14 since h(064212848) = 064212848 mod 111 = 14. Collision may occur since h(k) is not one-to-one. –Resolve by assigning next free location.

17
Pseudorandom Numbers Linear congruential method –Choose: modulus m, multiplier a, increment c, and seed x 0, with 2 a < m, 0 c, x 0 < m –Generate the sequence {x n } x n+1 = (a x n + c) mod m. –Example m = 9, a = 7, c = 4, and x 0 = 3: x 1 = 7x 0 +4 mod 9 = 7 3 + 4 mod 9 = 25 mod 9 = 7 x 2 =8, x 3 =6, x 4 =1, x 5 =2, x 6 =0, x 7 =4, x 8 =5, x 9 =3. –Usually, a pure multiplicative generator is used: Increment c=0, modulus m=2 31 – 1, multiplier a=7 5 =16,807.

18
Cryptology Caesar’s encryption process: –Represent each letter by an integer from 0 to 25 –Replace a letter represented by p by the letter represented by f(p) = (p + 3) mod 26. –Example M 12, f (12) = (12+3) mod 26 = 15 P “Meet you in the park’’ is replaced by “Phhw brx lq wkh sdun” –Decryption. To recover the original message, use the inverse function f -1 (p)= (p - 3) mod 26.

19
Cryptology – Cont. Caesar cipher can be generalized: –Shift cipher: f(p) = (p + k) mod 26. –Affine transformation: f(p) = (ap + b) mod 26, where a and be are integers chosen so that f is a bijection. Example f(p) = (7p + 3) mod 26, K? –K 10, f (10) = (7 10 + 3) mod 26 = 73 mod 26 = 21 V. –K is replaced by V in the encrypted message.

Similar presentations

Presentation is loading. Please wait....

OK

BY MISS FARAH ADIBAH ADNAN IMK

BY MISS FARAH ADIBAH ADNAN IMK

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on job satisfaction among employees Ppt on computer virus symptoms Ppt on student leadership Ppt on gujarati culture Ppt on waves tides and ocean currents Ppt on gear pump Ppt on excess demand and deficient demand unemployment Download ppt on oxidation and reduction in organic chemistry Ppt on different model of atoms Ppt on robert frost poems