CSE 311 Lecture 13: Primes and GCD. Emina Torlak and Kevin Zatloukal
|
|
- Branden Benson
- 5 years ago
- Views:
Transcription
1 CSE 311 Lecture 13: Primes and GCD Emina Torlak and Kevin Zatloukal 1
2 Topics Modular arithmetic applications A quick wrap-up of Lecture 12. Primes Fundamental theorem of arithmetic, Euclid s theorem, factoring. Greatest Common Divisors (GCD) GCD definition and properties. Euclidean algorithm Computing GCDs with the Euclidean algorithm. Extended Euclidean algorithm Bézout s theorem and the extended Euclidean algorithm. 2
3 Modular arithmetic applications A quick wrap-up of Lecture 12.
4 3
5 Modular arithmetic properties Modular addition property Let m be a positive integer ( m Z with m > 0). If and, then. a b (mod m) c d (mod m) a + c b + d (mod m) Modular multiplication property Let m be a positive integer ( m Z with m > 0). If and, then. a b (mod m) c d (mod m) ac bd (mod m) 4
6 Unsigned integer representation x n i= 0 b i2 i b i {0, 1} bn 1 b 2 b 1 b 0 Represent integer as a sum of powers of 2: x = n 1 If where each, then the representation is. Examples: 99 = = n = 8 99 = = So for : 5
7 Sign-magnitude integer representation 2 n 1 < x < 2 n 1 x n If, represent with bits as follows: Use the first bit as the sign (0 for positive and 1 for negative), and the remaining bits as the (unsigned) value. n 1 Examples: 99 = = n = 8 99 = = = So for : The problem with this representation is that our standard arithmetic algorithms no longer work, e.g., adding the representation of -18 and 99 doesn t give the representation of 81. 6
8 Two s complement integer representation x n Represent with bits as follows: If 0 x < 2 n 1, use the n-bit unsigned representation of x. If, use the -bit unsigned representation of. 2 n 1 x < 0 n + x 2 n Key property: Two s complement representation of any number so arithmetic works. y mod 2 n mod 2 n y is equivalent to 7
9 Two s complement integer representation x n Represent with bits as follows: If 0 x < 2 n 1, use the n-bit unsigned representation of x. If, use the -bit unsigned representation of. 2 n 1 x < 0 n + x 2 n Key property: Two s complement representation of any number so arithmetic works. y mod 2 n mod 2 n y is equivalent to Examples: So for : 99 = = = = 238 = = n = 8 99 = = =
10 Two s complement integer representation x n Represent with bits as follows: If 0 x < 2 n 1, use the n-bit unsigned representation of x. If, use the -bit unsigned representation of. 2 n 1 x < 0 n + x 2 n Key property: Two s complement representation of any number so arithmetic works. y mod 2 n mod 2 n y is equivalent to Examples: So for : 99 = = = = 238 = = n = 8 99 = = = Arithmetic mod 2 n is easy in hardware: just throw away bits n+ 1 and higher. 7
11 Computing the two s complement representation 2 n 1 x < 0 x n 2 n + x = 2 n x For, is represented using the -bit unsigned representation of. To compute this value: n Compute the -bit unsigned representation of. Flip the bits of x to get the representation of 2 n 1 x. Add 1 to get. 2 n x This computation works because x + x 2 n 1 x = 2 n 1 x x + 1 = 2 n x x is all 1s, which represents. So we have and. 8
12 Computing the two s complement representation 2 n 1 x < 0 x n 2 n + x = 2 n x For, is represented using the -bit unsigned representation of. To compute this value: n Compute the -bit unsigned representation of. Flip the bits of x to get the representation of 2 n 1 x. Add 1 to get. 2 n x This computation works because x + x 2 n 1 x = 2 n 1 x x + 1 = 2 n x is all 1s, which represents. So we have and. Example: -18 in 8-bit two s complement 18 in 8-bit unsigned: Flip the bits: Add 1: x 8
13 Applications of modular arithmetic Modular arithmetic is the basis of modern computing, with many applications. Examples include hashing, pseudo-random numbers, and simple ciphers. 9
14 Hashing Problem: We want to map a small number of data values from a large domain {0, 1,, M 1} into a small set of locations {0, 1,, n 1} to be able to quickly check if a value is present. Solution: Compute hash(x) = x mod p for a prime p close to n. Or, compute for a prime close to. hash(x) = ax + b mod p p n This approach depends on all of the bits of data the data. Helps avoid collisions due to similar values. But need to manage them if they occur. 10
15 Pseudo-random number generation Linear Congruential method x n+ 1 = (a + c) mod m x n x 0 a, c, m x n Choose randomly and carefully to produce a sequence of s. 11
16 Pseudo-random number generation Linear Congruential method x n+ 1 Choose randomly and carefully to produce a sequence of s. Example = (a + c) mod m x n x 0 a, c, m x n a = , c = 12345, m = 2 31 from BSD x 0 = 311 x 1 = , x 2 = , x 3 = , 11
17 Simple ciphers Ceasar or shi! cipher Treat letters as numbers: A = 0, B = 1, f (p) = (p + k) mod 26 f 1 (p) = (p k) mod 26 More general version f (p) = (ap + b) mod 26 f 1 (p) = ( a 1 (p b)) mod 26 12
18 Simple ciphers Ceasar or shi! cipher Treat letters as numbers: A = 0, B = 1, f (p) = (p + k) mod 26 f 1 (p) = (p k) mod 26 More general version a 1 f (p) = (ap + b) mod 26 f 1 (p) = ( a 1 (p b)) mod 26 is the multiplicative inverse of modulo 26, and we ll soon see how to compute these inverses. a 12
19 Primes Fundamental theorem of arithmetic, Euclid s theorem, factoring. 13
20 Primality Prime number An integer is called prime if its only positive factors are and. Composite number An integer p > 1 1 p c > 1 is called composite if it is not prime. 14
21 Primality Prime number An integer is called prime if its only positive factors are and. Composite number An integer p > 1 1 p c > 1 is called composite if it is not prime. A prime number is divisible only by itself and 1. We say that is a factor of if. a b a b Note that 1 is neither prime nor composite. The above definitions apply only to integers greater than 1. 14
22 A key theorem about all positive integers Fundamental theorem of arithmetic Every positive integer greater than 1 has a unique prime factorization. 15
23 A key theorem about all positive integers Fundamental theorem of arithmetic Every positive integer greater than 1 has a unique prime factorization. In other words, every integer can be written uniquely as a prime, or the product of two or more primes ordered by size. Examples n> 1 48 = = , 523 = 45, , 950 = , 234, 567, 890 = , 607 3,
24 A key theorem about primes Euclid s theorem There are infinitely many primes. 16
25 A key theorem about primes Euclid s theorem There are infinitely many primes. Proof by contradiction: 16
26 A key theorem about primes Euclid s theorem There are infinitely many primes. Proof by contradiction: Suppose that there are finitely many primes:. p 1,, p n 16
27 A key theorem about primes Euclid s theorem There are infinitely many primes. Proof by contradiction: Suppose that there are finitely many primes: p 1,, p n. Define the number, and let. P = p 1 p n Q = P
28 A key theorem about primes Euclid s theorem There are infinitely many primes. Proof by contradiction: Suppose that there are finitely many primes: p 1,, p n. Define the number P = p 1 p n, and let Q = P + 1. Case 1: If Q > 1 is prime, then Q is a prime different from all of p 1,, p n, since it is bigger than all of them. This contradicts the assumption that the list includes all primes. p 1,, p n 16
29 A key theorem about primes Euclid s theorem There are infinitely many primes. Proof by contradiction: Suppose that there are finitely many primes: p 1,, p n. Define the number P = p 1 p n, and let Q = P + 1. Case 1: If Q > 1 is prime, then Q is a prime different from all of p 1,, p n, since it is bigger than all of them. This contradicts the assumption that the list p 1,, p n includes all primes. Case 2: If Q > 1 is not prime, then Q has some prime factor p, which must be in p 1,, p n. Therefore p P and p Q so P = jp and Q = kp for some integers j, k. We then have Q P = (k j)p = 1, which means that p 1. But no prime divides 1, leading again to a contradiction. 16
30 A key theorem about primes Euclid s theorem There are infinitely many primes. Proof by contradiction: Suppose that there are finitely many primes: p 1,, p n. Define the number P = p 1 p n, and let Q = P + 1. Case 1: If Q > 1 is prime, then Q is a prime different from all of p 1,, p n, since it is bigger than all of them. This contradicts the assumption that the list p 1,, p n includes all primes. Case 2: If Q > 1 is not prime, then Q has some prime factor p, which must be in p 1,, p n. Therefore p P and p Q so P = jp and Q = kp for some integers j, k. We then have Q P = (k j)p = 1, which means that p 1. But no prime divides 1, leading again to a contradiction. Since both cases are contradictions, the assumption must be false. 16
31 Important algorithmic problems Primality testing Given an integer, determine if n is prime. Factoring Given an integer, determine the prime factorization of. n n n 17
32 Important algorithmic problems Primality testing Given an integer, determine if n is prime. Factoring Given an integer, determine the prime factorization of. n n We don t know of an efficient algorithm for factoring large numbers. The security of commonly used cryptographic protocols (e.g., RSA) hinges on this fact. For example, it took two years and thousands of machine-hours to factor a 232-digit (768-bit) number known as RSA-768. But factoring is easy for quantum computers! n 17
33 Greatest Common Divisors (GCD) GCD definition and properties. 18
34 Definition of greatest common divisor (GCD) Greatest common divisor (GCD) The greatest common divisor of integers a and b, written as GCD(a, b), is the largest integer such that and. d d a d b 19
35 Definition of greatest common divisor (GCD) Greatest common divisor (GCD) The greatest common divisor of integers a and b, written as GCD(a, b), is the largest integer such that and. Examples: GCD(100, 125) = GCD(17, 49) = GCD(11, 66) = GCD(13, 0) = GCD(180, 252) = d d a d b 19
36 Definition of greatest common divisor (GCD) Greatest common divisor (GCD) The greatest common divisor of integers a and b, written as GCD(a, b), is the largest integer such that and. Examples: GCD(100, 125) = 25 GCD(17, 49) = GCD(11, 66) = GCD(13, 0) = GCD(180, 252) = d d a d b 19
37 Definition of greatest common divisor (GCD) Greatest common divisor (GCD) The greatest common divisor of integers a and b, written as GCD(a, b), is the largest integer such that and. Examples: GCD(100, 125) = 25 GCD(17, 49) = 1 GCD(11, 66) = GCD(13, 0) = GCD(180, 252) = d d a d b 19
38 Definition of greatest common divisor (GCD) Greatest common divisor (GCD) The greatest common divisor of integers a and b, written as GCD(a, b), is the largest integer such that and. Examples: GCD(100, 125) = 25 GCD(17, 49) = 1 GCD(11, 66) = 11 GCD(13, 0) = GCD(180, 252) = d d a d b 19
39 Definition of greatest common divisor (GCD) Greatest common divisor (GCD) The greatest common divisor of integers a and b, written as GCD(a, b), is the largest integer such that and. Examples: GCD(100, 125) = 25 GCD(17, 49) = 1 GCD(11, 66) = 11 GCD(13, 0) = 13 GCD(180, 252) = d d a d b 19
40 Definition of greatest common divisor (GCD) Greatest common divisor (GCD) The greatest common divisor of integers a and b, written as GCD(a, b), is the largest integer such that and. Examples: GCD(100, 125) = 25 GCD(17, 49) = 1 GCD(11, 66) = 11 GCD(13, 0) = 13 GCD(180, 252) = 36 d d a d b 19
41 GCD(a, b) How can we compute? a a = = 46, 20 b = = 204, 750 A naive approach is to first factor both and : b 20
42 How can we compute? A naive approach is to first factor both and : And then compute GCD(a, b) a a = = 46, 20 b = = 204, 750 GCD(a, b) as follows: GCD(a, b) = 2 min(3,1) 3 min(1,2) 5 min(2,3) 7 min(1,1) 11 min(1,0) 13 min(0,1) b 20
43 How can we compute? A naive approach is to first factor both and : And then compute GCD(a, b) a a = = 46, 20 b = = 204, 750 GCD(a, b) as follows: GCD(a, b) = 2 min(3,1) 3 min(1,2) 5 min(2,3) 7 min(1,1) 11 min(1,0) 13 min(0,1) b But factoring is expensive! Can we compute GCD(a, b) without factoring? 20
44 Euclidean algorithm Computing GCDs with the Euclidean algorithm. 21
45 Euclidean algorithm is based on two useful facts GCD(a, 0) If a is a positive integer, then GCD(a, 0) = a. 22
46 Euclidean algorithm is based on two useful facts GCD(a, 0) a GCD(a, 0) = a If is a positive integer, then. Proof follows straightforwardly from the definition of GCD and divisibility. 22
47 Euclidean algorithm is based on two useful facts GCD(a, 0) a GCD(a, 0) = a If is a positive integer, then. Proof follows straightforwardly from the definition of GCD and divisibility. GCD and modulo If and are positive integers, then. a b GCD(a, b) = GCD(b, a mod b) 22
48 Euclidean algorithm is based on two useful facts GCD(a, 0) a GCD(a, 0) = a If is a positive integer, then. Proof follows straightforwardly from the definition of GCD and divisibility. GCD and modulo If and are positive integers, then. Proof: a b GCD(a, b) = GCD(b, a mod b) 22
49 Euclidean algorithm is based on two useful facts GCD(a, 0) a GCD(a, 0) = a If is a positive integer, then. Proof follows straightforwardly from the definition of GCD and divisibility. GCD and modulo If and are positive integers, then. a b GCD(a, b) = GCD(b, a mod b) Proof: First note that by definition of mod, for some integer. a = qb + a mod b q = a div b 22
50 Euclidean algorithm is based on two useful facts GCD(a, 0) a GCD(a, 0) = a If is a positive integer, then. Proof follows straightforwardly from the definition of GCD and divisibility. GCD and modulo If and are positive integers, then. a b GCD(a, b) = GCD(b, a mod b) Proof: First note that by definition of mod, for some integer. d = GCD(a, b) Now, let. a = qb + a mod b q = a div b 22
51 Euclidean algorithm is based on two useful facts GCD(a, 0) a GCD(a, 0) = a If is a positive integer, then. Proof follows straightforwardly from the definition of GCD and divisibility. GCD and modulo If and are positive integers, then. a b GCD(a, b) = GCD(b, a mod b) Proof: First note that by definition of mod, for some integer. a = qb + a mod b q = a div b d = GCD(a, b) d a d b a = kd b = jd k, j Z Now, let. Then and, so and for some. 22
52 Euclidean algorithm is based on two useful facts GCD(a, 0) a GCD(a, 0) = a If is a positive integer, then. Proof follows straightforwardly from the definition of GCD and divisibility. GCD and modulo If and are positive integers, then. a b GCD(a, b) = GCD(b, a mod b) Proof: First note that by definition of mod, for some integer. a = qb + a mod b q = a div b d = GCD(a, b) d a d b a = kd b = jd k, j Z a mod b = a qb = kd qjd = d(k qj) Now, let. Then and, so and for some. Therefore,. 22
53 Euclidean algorithm is based on two useful facts GCD(a, 0) a GCD(a, 0) = a If is a positive integer, then. Proof follows straightforwardly from the definition of GCD and divisibility. GCD and modulo If and are positive integers, then. a b GCD(a, b) = GCD(b, a mod b) Proof: First note that by definition of mod, for some integer. a = qb + a mod b q = a div b d = GCD(a, b) d a d b a = kd b = jd k, j Z Now, let. Then and, so and for some. Therefore, a mod b = a qb = kd qjd = d(k qj). So, d (a mod b) and since d b, we have that. d = GCD(a, b) GCD(b, a mod b) 22
54 Euclidean algorithm is based on two useful facts GCD(a, 0) a GCD(a, 0) = a If is a positive integer, then. Proof follows straightforwardly from the definition of GCD and divisibility. GCD and modulo If and are positive integers, then. a b GCD(a, b) = GCD(b, a mod b) Proof: First note that by definition of mod, for some integer. Now, let. Then and, so and for some. Therefore, a mod b = a qb = kd qjd = d(k qj). So, d (a mod b) and since d b, we have that. Next, let. a = qb + a mod b q = a div b d = GCD(a, b) d a d b a = kd b = jd k, j Z d = GCD(a, b) GCD(b, a mod b) e = GCD(b, a mod b) 22
55 Euclidean algorithm is based on two useful facts GCD(a, 0) a GCD(a, 0) = a If is a positive integer, then. Proof follows straightforwardly from the definition of GCD and divisibility. GCD and modulo If and are positive integers, then. a b GCD(a, b) = GCD(b, a mod b) Proof: First note that by definition of mod, for some integer. a = qb + a mod b Now, let. Then and, so and for some. Therefore, a mod b = a qb = kd qjd = d(k qj). So, d (a mod b) and since d b, we have that. Next, let. Then and, so and for some. q = a div b d = GCD(a, b) d a d b a = kd b = jd k, j Z d = GCD(a, b) GCD(b, a mod b) e = GCD(b, a mod b) e b e (a mod b) b = me a mod b = ne m, n Z 22
56 Euclidean algorithm is based on two useful facts GCD(a, 0) a GCD(a, 0) = a If is a positive integer, then. Proof follows straightforwardly from the definition of GCD and divisibility. GCD and modulo If and are positive integers, then. a b GCD(a, b) = GCD(b, a mod b) Proof: First note that by definition of mod, for some integer. a = qb + a mod b Now, let. Then and, so and for some. Therefore, a mod b = a qb = kd qjd = d(k qj). So, d (a mod b) and since d b, we have that. Next, let. Then and, so and for some. Therefore,. q = a div b d = GCD(a, b) d a d b a = kd b = jd k, j Z d = GCD(a, b) GCD(b, a mod b) e = GCD(b, a mod b) e b e (a mod b) b = me a mod b = ne m, n Z a = qb + a mod b = qme + ne 22
57 Euclidean algorithm is based on two useful facts GCD(a, 0) a GCD(a, 0) = a If is a positive integer, then. Proof follows straightforwardly from the definition of GCD and divisibility. GCD and modulo If and are positive integers, then. a b GCD(a, b) = GCD(b, a mod b) Proof: First note that by definition of mod, for some integer. a = qb + a mod b q = a div b d = GCD(a, b) d a d b a = kd b = jd k, j Z Now, let. Then and, so and for some. Therefore, a mod b = a qb = kd qjd = d(k qj). So, d (a mod b) and since d b, we have that. d = GCD(a, b) GCD(b, a mod b) e = GCD(b, a mod b) e b e (a mod b) b = me a mod b = ne Next, let. Then and, so and for some m, n Z. Therefore, a = qb + a mod b = qme + ne. So, e a and e b, we have that. e = GCD(b, a mod b) GCD(a, b) 22
58 Euclidean algorithm is based on two useful facts GCD(a, 0) a GCD(a, 0) = a If is a positive integer, then. Proof follows straightforwardly from the definition of GCD and divisibility. GCD and modulo If and are positive integers, then. a b GCD(a, b) = GCD(b, a mod b) Proof: First note that by definition of mod, for some integer. a = qb + a mod b q = a div b d = GCD(a, b) d a d b a = kd b = jd k, j Z Now, let. Then and, so and for some. Therefore, a mod b = a qb = kd qjd = d(k qj). So, d (a mod b) and since d b, we have that. d = GCD(a, b) GCD(b, a mod b) e = GCD(b, a mod b) e b e (a mod b) b = me a mod b = ne Next, let. Then and, so and for some m, n Z. Therefore, a = qb + a mod b = qme + ne. So, e a and e b, we have that. The result follows from these cases. e = GCD(b, a mod b) GCD(a, b) 22
59 Euclidean algorithm Apply GCD(a, b) = GCD(b, a mod b) until you get GCD(a, 0) = a. Example implementation: // Assumes a >= b >= 0. public static int gcd(int a, int b) { if (b == 0) return a; // GCD(a, 0) = a else return gcd(b, a % b); // GCD(a, b) = GCD(b, a mod b) } 23
60 Euclidean algorithm Apply GCD(a, b) = GCD(b, a mod b) until you get GCD(a, 0) = a. Example implementation: // Assumes a >= b >= 0. public static int gcd(int a, int b) { if (b == 0) return a; // GCD(a, 0) = a else return gcd(b, a % b); // GCD(a, b) = GCD(b, a mod b) } GCD(660, 126) 23
61 Euclidean algorithm Apply GCD(a, b) = GCD(b, a mod b) until you get GCD(a, 0) = a. Example implementation: // Assumes a >= b >= 0. public static int gcd(int a, int b) { if (b == 0) return a; // GCD(a, 0) = a else return gcd(b, a % b); // GCD(a, b) = GCD(b, a mod b) } GCD(660, 126) = GCD(126, 660 mod 126) = GCD(126, 30) 23
62 Euclidean algorithm Apply GCD(a, b) = GCD(b, a mod b) until you get GCD(a, 0) = a. Example implementation: // Assumes a >= b >= 0. public static int gcd(int a, int b) { if (b == 0) return a; // GCD(a, 0) = a else return gcd(b, a % b); // GCD(a, b) = GCD(b, a mod b) } GCD(660, 126) = GCD(126, 660 mod 126) = GCD(126, 30) = GCD(30, 126 mod 30) = GCD(30, 6) 23
63 Euclidean algorithm Apply GCD(a, b) = GCD(b, a mod b) until you get GCD(a, 0) = a. Example implementation: // Assumes a >= b >= 0. public static int gcd(int a, int b) { if (b == 0) return a; // GCD(a, 0) = a else return gcd(b, a % b); // GCD(a, b) = GCD(b, a mod b) } GCD(660, 126) = GCD(126, 660 mod 126) = GCD(126, 30) = GCD(30, 126 mod 30) = GCD(30, 6) = GCD(6, 30 mod 6) = GCD(6, 0) 23
64 Euclidean algorithm Apply GCD(a, b) = GCD(b, a mod b) until you get GCD(a, 0) = a. Example implementation: // Assumes a >= b >= 0. public static int gcd(int a, int b) { if (b == 0) return a; // GCD(a, 0) = a else return gcd(b, a % b); // GCD(a, b) = GCD(b, a mod b) } GCD(660, 126) = GCD(126, 660 mod 126) = GCD(126, 30) = GCD(30, 126 mod 30) = GCD(30, 6) = GCD(6, 30 mod 6) = GCD(6, 0) = 6 23
65 Euclidean algorithm Apply GCD(a, b) = GCD(b, a mod b) until you get GCD(a, 0) = a. Example implementation: // Assumes a >= b >= 0. public static int gcd(int a, int b) { if (b == 0) return a; // GCD(a, 0) = a else return gcd(b, a % b); // GCD(a, b) = GCD(b, a mod b) } GCD(660, 126) = GCD(126, 660 mod 126) = GCD(126, 30) = GCD(30, 126 mod 30) = GCD(30, 6) = GCD(6, 30 mod 6) = GCD(6, 0) = 6 In tableau form: 660 = 5 * = 4 * = 5 *
66 Extended Euclidean algorithm Bézout s theorem and the extended Euclidean algorithm. 24
67 Bézout s theorem about GCDs Bézout s theorem If a and b are positive integers, then there exist integers s and t such that. GCD(a, b) = sa + tb 25
68 Bézout s theorem about GCDs Bézout s theorem If a and b are positive integers, then there exist integers s and t such that. GCD(a, b) = sa + tb We can extend Euclidean algorithm to find computing. GCD(a, b) s t and in addition to 25
69 Extended Euclidean algorithm 1. Compute GCD and keep the tableau. GCD(35, 27) = 35s + 27t. 26
70 Extended Euclidean algorithm 1. Compute GCD and keep the tableau. GCD(35, 27) = 35s + 27t. a = q b + r 35 = = = = GCD(a, b) GCD(b, a mod b) r = a mod b GCD(35, 27) = GCD(27, 35 mod 27) = GCD(27, 8) = GCD(8, 27 mod 8) = GCD(8, 3) = GCD(3, 8 mod 3) = GCD(3, 2) = GCD(2, 3 mod 2) = GCD(2, 1) = GCD(1, 2 mod 1) = GCD(1, 0) 26
71 Extended Euclidean algorithm 1. Compute GCD and keep the tableau. 2. Solve the equations for in the tableau. r GCD(35, 27) = 35s + 27t. a = q b + r 35 = = = = r = a q b 8 = = = =
72 Extended Euclidean algorithm 1. Compute GCD and keep the tableau. 2. Solve the equations for r in the tableau. 3. Back substitute the equations for. r GCD(35, 27) = 35s + 27t. r = a q b 8 = = = =
73 Extended Euclidean algorithm 1. Compute GCD and keep the tableau. 2. Solve the equations for r in the tableau. 3. Back substitute the equations for. r GCD(35, 27) = 35s + 27t. r = a q b 8 = = = = = 3 1 (8 2 3) = = ( 1) Plug in the def of 2. Group 8 s and 3 s. 28
74 Extended Euclidean algorithm 1. Compute GCD and keep the tableau. 2. Solve the equations for r in the tableau. 3. Back substitute the equations for. r GCD(35, 27) = 35s + 27t. r = a q b 8 = = = = = 3 1 (8 2 3) = = ( 1) = ( 1) (27 3 8) = ( 1) ( 9) 8 = ( 10) 8 Plug in the def of 2. Group 8 s and 3 s. Plug in the def of 3. Group 8 s and 27 s. 28
75 Extended Euclidean algorithm 1. Compute GCD and keep the tableau. 2. Solve the equations for r in the tableau. 3. Back substitute the equations for. r GCD(35, 27) = 35s + 27t. r = a q b 8 = = = = = 3 1 (8 2 3) = = ( 1) = ( 1) (27 3 8) = ( 1) ( 9) 8 = ( 10) 8 = ( 10) ( ) = ( 10) = ( 10) 35 Plug in the def of 2. Group 8 s and 3 s. Plug in the def of 3. Group 8 s and 27 s. Plug in the def of 8. Group 27 s and 35 s. 28
76 Multiplicative inverse GCD(a, m) = 1 Suppose. mod m By Bézout s Theorem, there exist integers. sa + tm = 1 s t and such that s mod m is the multiplicative inverse of a 1 = (sa + tm) mod m = sa mod m 29
77 Using multiplicative inverses to solve modular equations Solve: 7x 1 (mod 26) 30
78 Using multiplicative inverses to solve modular equations Solve: 7x 1 (mod 26) Compute GCD and keep the tableau. GCD(26, 7) = GCD(7, 5) = GCD(5, 2) = GCD(2, 1) = GCD(1, 0) = 1 30
79 Using multiplicative inverses to solve modular equations Solve: 7x 1 (mod 26) Compute GCD and keep the tableau. GCD(26, 7) = GCD(7, 5) = GCD(5, 2) = GCD(2, 1) = GCD(1, 0) = 1 Solve the equations for a = b q + r 26 = = = r in the tableau. r = a b q 5 = = =
80 Using multiplicative inverses to solve modular equations Solve: 7x 1 (mod 26) Compute GCD and keep the tableau. GCD(26, 7) = GCD(7, 5) = GCD(5, 2) = GCD(2, 1) = GCD(1, 0) = 1 Solve the equations for r in the tableau. Back substitute the equations for. 1 = 5 2 (7 5 1) = ( 2) = ( 2) (26 7 3) = ( 11) r a = b q + r 26 = = = r = a b q 5 = = =
81 Using multiplicative inverses to solve modular equations Solve: 7x 1 (mod 26) Compute GCD and keep the tableau. GCD(26, 7) = GCD(7, 5) = GCD(5, 2) = GCD(2, 1) = GCD(1, 0) = 1 Solve the equations for a = b q + r 26 = = = r in the tableau. r = a b q 5 = = = Back substitute the equations for. 1 = 5 2 (7 5 1) = ( 2) = ( 2) (26 7 3) = ( 11) x Solve for. Multiplicative inverse of 7 mod 26 ( 11) mod 26 = 15 x = 26k + 15 k Z So, for. r 30
82 Summary p > 1 Every positive integer is either prime or composite. p is prime if its only factors are p and 1. Otherwise, is composite. p GCD(a, b) a b is the greatest integer that divides both and. It can be computed efficiently using the Euclidean algorithm. GCD(a, b) = sa + tb By Bézout s Theorem, for some integers. s, t can be computed using the extended Euclidean algorithm. If, is the multiplicative inverse of modulo. GCD(a, b) = 1 s mod b a b s, t 31
CSE 311: Foundations of Computing. Lecture 12: Two s Complement, Primes, GCD
CSE 311: Foundations of Computing Lecture 12: Two s Complement, Primes, GCD n-bit Unsigned Integer Representation Represent integer as sum of powers of 2: If 2 where each {0,1} then representation is b
More informationcse 311: foundations of computing Fall 2015 Lecture 12: Primes, GCD, applications
cse 311: foundations of computing Fall 2015 Lecture 12: Primes, GCD, applications n-bit unsigned integer representation Represent integer x as sum of powers of 2: If x = n 1 i=0 b i 2 i where each b i
More informationcse 311: foundations of computing Spring 2015 Lecture 12: Primes, GCD, applications
cse 311: foundations of computing Spring 2015 Lecture 12: Primes, GCD, applications casting out 3s Theorem: A positive integer n is divisible by 3 if and only if the sum of its decimal digits is divisible
More informationCSE 311 Lecture 11: Modular Arithmetic. Emina Torlak and Kevin Zatloukal
CSE 311 Lecture 11: Modular Arithmetic Emina Torlak and Kevin Zatloukal 1 Topics Sets and set operations A quick wrap-up of Lecture 10. Modular arithmetic basics Arithmetic over a finite domain (a.k.a
More informationcse 311: foundations of computing Fall 2015 Lecture 11: Modular arithmetic and applications
cse 311: foundations of computing Fall 2015 Lecture 11: Modular arithmetic and applications arithmetic mod 7 a + 7 b = (a + b) mod 7 a 7 b = (a b) mod 7 5 6 0 1 2 4 3 + 0 1 2 3 4 5 6 0 0 1 2 3 4 5 6 1
More informationFall 2015 Lecture 14: Modular congruences. cse 311: foundations of computing
Fall 2015 Lecture 14: Modular congruences cse 311: foundations of computing If a and b are positive integers, then gcd a, b = gcd (b, a mod b) Useful GCD Fact Proof: By definition a = a div b b + (a mod
More informationCPSC 467b: Cryptography and Computer Security
CPSC 467b: Cryptography and Computer Security Michael J. Fischer Lecture 8 February 1, 2012 CPSC 467b, Lecture 8 1/42 Number Theory Needed for RSA Z n : The integers mod n Modular arithmetic GCD Relatively
More informationCSE 20 DISCRETE MATH. Winter
CSE 20 DISCRETE MATH Winter 2017 http://cseweb.ucsd.edu/classes/wi17/cse20-ab/ Today's learning goals Define and use the congruence modulo m equivalence relation Perform computations using modular arithmetic
More information8 Primes and Modular Arithmetic
8 Primes and Modular Arithmetic 8.1 Primes and Factors Over two millennia ago already, people all over the world were considering the properties of numbers. One of the simplest concepts is prime numbers.
More informationApplied Cryptography and Computer Security CSE 664 Spring 2017
Applied Cryptography and Computer Security Lecture 11: Introduction to Number Theory Department of Computer Science and Engineering University at Buffalo 1 Lecture Outline What we ve covered so far: symmetric
More informationNotes. Number Theory: Applications. Notes. Number Theory: Applications. Notes. Hash Functions I
Number Theory: Applications Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry Fall 2007 Computer Science & Engineering 235 Introduction to Discrete Mathematics Sections 3.4 3.7 of Rosen cse235@cse.unl.edu
More informationCOMP239: Mathematics for Computer Science II. Prof. Chadi Assi EV7.635
COMP239: Mathematics for Computer Science II Prof. Chadi Assi assi@ciise.concordia.ca EV7.635 The Euclidean Algorithm The Euclidean Algorithm Finding the GCD of two numbers using prime factorization is
More informationSenior Math Circles Cryptography and Number Theory Week 2
Senior Math Circles Cryptography and Number Theory Week 2 Dale Brydon Feb. 9, 2014 1 Divisibility and Inverses At the end of last time, we saw that not all numbers have inverses mod n, but some do. We
More informationNumber Theory: Applications. Number Theory Applications. Hash Functions II. Hash Functions III. Pseudorandom Numbers
Number Theory: Applications Number Theory Applications Computer Science & Engineering 235: Discrete Mathematics Christopher M. Bourke cbourke@cse.unl.edu Results from Number Theory have many applications
More informationDiscrete Mathematics GCD, LCM, RSA Algorithm
Discrete Mathematics GCD, LCM, RSA Algorithm Abdul Hameed http://informationtechnology.pk/pucit abdul.hameed@pucit.edu.pk Lecture 16 Greatest Common Divisor 2 Greatest common divisor The greatest common
More informationLecture 5: Arithmetic Modulo m, Primes and Greatest Common Divisors Lecturer: Lale Özkahya
BBM 205 Discrete Mathematics Hacettepe University http://web.cs.hacettepe.edu.tr/ bbm205 Lecture 5: Arithmetic Modulo m, Primes and Greatest Common Divisors Lecturer: Lale Özkahya Resources: Kenneth Rosen,
More informationMath.3336: Discrete Mathematics. Primes and Greatest Common Divisors
Math.3336: Discrete Mathematics Primes and Greatest Common Divisors Instructor: Dr. Blerina Xhabli Department of Mathematics, University of Houston https://www.math.uh.edu/ blerina Email: blerina@math.uh.edu
More information4 Number Theory and Cryptography
4 Number Theory and Cryptography 4.1 Divisibility and Modular Arithmetic This section introduces the basics of number theory number theory is the part of mathematics involving integers and their properties.
More information1 Overview and revision
MTH6128 Number Theory Notes 1 Spring 2018 1 Overview and revision In this section we will meet some of the concerns of Number Theory, and have a brief revision of some of the relevant material from Introduction
More informationCS March 17, 2009
Discrete Mathematics CS 2610 March 17, 2009 Number Theory Elementary number theory, concerned with numbers, usually integers and their properties or rational numbers mainly divisibility among integers
More informationCPSC 467: Cryptography and Computer Security
CPSC 467: Cryptography and Computer Security Michael J. Fischer Lecture 9 September 30, 2015 CPSC 467, Lecture 9 1/47 Fast Exponentiation Algorithms Number Theory Needed for RSA Elementary Number Theory
More informationECE 646 Lecture 5. Mathematical Background: Modular Arithmetic
ECE 646 Lecture 5 Mathematical Background: Modular Arithmetic Motivation: Public-key ciphers RSA as a trap-door one-way function PUBLIC KEY message ciphertext M C = f(m) = M e mod N C M = f -1 (C) = C
More informationNumber Theory. CSS322: Security and Cryptography. Sirindhorn International Institute of Technology Thammasat University CSS322. Number Theory.
CSS322: Security and Cryptography Sirindhorn International Institute of Technology Thammasat University Prepared by Steven Gordon on 29 December 2011 CSS322Y11S2L06, Steve/Courses/2011/S2/CSS322/Lectures/number.tex,
More informationCh 4.2 Divisibility Properties
Ch 4.2 Divisibility Properties - Prime numbers and composite numbers - Procedure for determining whether or not a positive integer is a prime - GCF: procedure for finding gcf (Euclidean Algorithm) - Definition:
More information3 The fundamentals: Algorithms, the integers, and matrices
3 The fundamentals: Algorithms, the integers, and matrices 3.4 The integers and division This section introduces the basics of number theory number theory is the part of mathematics involving integers
More informationCOT 3100 Applications of Discrete Structures Dr. Michael P. Frank
University of Florida Dept. of Computer & Information Science & Engineering COT 3100 Applications of Discrete Structures Dr. Michael P. Frank Slides for a Course Based on the Text Discrete Mathematics
More informationThe Euclidean Algorithm and Multiplicative Inverses
1 The Euclidean Algorithm and Multiplicative Inverses Lecture notes for Access 2009 The Euclidean Algorithm is a set of instructions for finding the greatest common divisor of any two positive integers.
More informationThis is a recursive algorithm. The procedure is guaranteed to terminate, since the second argument decreases each time.
8 Modular Arithmetic We introduce an operator mod. Let d be a positive integer. For c a nonnegative integer, the value c mod d is the remainder when c is divided by d. For example, c mod d = 0 if and only
More informationReview. CS311H: Discrete Mathematics. Number Theory. Computing GCDs. Insight Behind Euclid s Algorithm. Using this Theorem. Euclidian Algorithm
Review CS311H: Discrete Mathematics Number Theory Instructor: Işıl Dillig What does it mean for two ints a, b to be congruent mod m? What is the Division theorem? If a b and a c, does it mean b c? What
More informationNumber Theory and Group Theoryfor Public-Key Cryptography
Number Theory and Group Theory for Public-Key Cryptography TDA352, DIT250 Wissam Aoudi Chalmers University of Technology November 21, 2017 Wissam Aoudi Number Theory and Group Theoryfor Public-Key Cryptography
More informationNumber Theory and Cryptography
. All rights reserved. Authorized only for instructor use in the classroom. No reproduction or further distribution permitted without the prior written consent of McGraw-Hill Education. Number Theory and
More informationNumbers. Çetin Kaya Koç Winter / 18
Çetin Kaya Koç http://koclab.cs.ucsb.edu Winter 2016 1 / 18 Number Systems and Sets We represent the set of integers as Z = {..., 3, 2, 1,0,1,2,3,...} We denote the set of positive integers modulo n as
More informationIntegers and Division
Integers and Division Notations Z: set of integers N : set of natural numbers R: set of real numbers Z + : set of positive integers Some elements of number theory are needed in: Data structures, Random
More informationIntroduction to Cryptography CS 355 Lecture 3
Introduction to Cryptography CS 355 Lecture 3 Elementary Number Theory (1) CS 355 Fall 2005/Lecture 3 1 Review of Last Lecture Ciphertext-only attack: Known-plaintext attack: Chosen-plaintext: Chosen-ciphertext:
More informationThe set of integers will be denoted by Z = {, -3, -2, -1, 0, 1, 2, 3, 4, }
Integers and Division 1 The Integers and Division This area of discrete mathematics belongs to the area of Number Theory. Some applications of the concepts in this section include generating pseudorandom
More information1. Algebra 1.7. Prime numbers
1. ALGEBRA 30 1. Algebra 1.7. Prime numbers Definition Let n Z, with n 2. If n is not a prime number, then n is called a composite number. We look for a way to test if a given positive integer is prime
More informationAddition. Ch1 - Algorithms with numbers. Multiplication. al-khwārizmī. al-khwārizmī. Division 53+35=88. Cost? (n number of bits) 13x11=143. Cost?
Ch - Algorithms with numbers Addition Basic arithmetic Addition ultiplication Division odular arithmetic factoring is hard Primality testing 53+35=88 Cost? (n number of bits) O(n) ultiplication al-khwārizmī
More informationThe following is an informal description of Euclid s algorithm for finding the greatest common divisor of a pair of numbers:
Divisibility Euclid s algorithm The following is an informal description of Euclid s algorithm for finding the greatest common divisor of a pair of numbers: Divide the smaller number into the larger, and
More informationLecture Notes. Advanced Discrete Structures COT S
Lecture Notes Advanced Discrete Structures COT 4115.001 S15 2015-01-13 Recap Divisibility Prime Number Theorem Euclid s Lemma Fundamental Theorem of Arithmetic Euclidean Algorithm Basic Notions - Section
More informationNumber Theory Basics Z = {..., 2, 1, 0, 1, 2,...} For, b Z, we say that divides b if z = b for some. Notation: b Fact: for all, b, c Z:
Number Theory Basics Z = {..., 2, 1, 0, 1, 2,...} For, b Z, we say that divides b if z = b for some z Z Notation: b Fact: for all, b, c Z:, 1, and 0 0 = 0 b and b c = c b and c = (b + c) b and b = ±b 1
More informationMath 131 notes. Jason Riedy. 6 October, Linear Diophantine equations : Likely delayed 6
Math 131 notes Jason Riedy 6 October, 2008 Contents 1 Modular arithmetic 2 2 Divisibility rules 3 3 Greatest common divisor 4 4 Least common multiple 4 5 Euclidean GCD algorithm 5 6 Linear Diophantine
More informationIntroduction to Number Theory. The study of the integers
Introduction to Number Theory The study of the integers of Integers, The set of integers = {... 3, 2, 1, 0, 1, 2, 3,...}. In this lecture, if nothing is said about a variable, it is an integer. Def. We
More informationMat Week 8. Week 8. gcd() Mat Bases. Integers & Computers. Linear Combos. Week 8. Induction Proofs. Fall 2013
Fall 2013 Student Responsibilities Reading: Textbook, Section 3.7, 4.1, & 5.2 Assignments: Sections 3.6, 3.7, 4.1 Proof Worksheets Attendance: Strongly Encouraged Overview 3.6 Integers and Algorithms 3.7
More informationSection Summary. Division Division Algorithm Modular Arithmetic
1 Chapter Motivation Number theory is the part of mathematics devoted to the study of the integers and their properties. Key ideas in number theory include divisibility and the primality of integers. Representations
More informationbasics of security/cryptography
RSA Cryptography basics of security/cryptography Bob encrypts message M into ciphertext C=P(M) using a public key; Bob sends C to Alice Alice decrypts ciphertext back into M using a private key (secret)
More informationCS 5319 Advanced Discrete Structure. Lecture 9: Introduction to Number Theory II
CS 5319 Advanced Discrete Structure Lecture 9: Introduction to Number Theory II Divisibility Outline Greatest Common Divisor Fundamental Theorem of Arithmetic Modular Arithmetic Euler Phi Function RSA
More informationNOTES ON INTEGERS. 1. Integers
NOTES ON INTEGERS STEVEN DALE CUTKOSKY The integers 1. Integers Z = {, 3, 2, 1, 0, 1, 2, 3, } have addition and multiplication which satisfy familar rules. They are ordered (m < n if m is less than n).
More informationStudent Responsibilities Week 8. Mat Section 3.6 Integers and Algorithms. Algorithm to Find gcd()
Student Responsibilities Week 8 Mat 2345 Week 8 Reading: Textbook, Section 3.7, 4.1, & 5.2 Assignments: Sections 3.6, 3.7, 4.1 Induction Proof Worksheets Attendance: Strongly Encouraged Fall 2013 Week
More informationMATH 501 Discrete Mathematics. Lecture 6: Number theory. German University Cairo, Department of Media Engineering and Technology.
MATH 501 Discrete Mathematics Lecture 6: Number theory Prof. Dr. Slim Abdennadher, slim.abdennadher@guc.edu.eg German University Cairo, Department of Media Engineering and Technology 1 Number theory Number
More informationMath.3336: Discrete Mathematics. Primes and Greatest Common Divisors
Math.3336: Discrete Mathematics Primes and Greatest Common Divisors Instructor: Dr. Blerina Xhabli Department of Mathematics, University of Houston https://www.math.uh.edu/ blerina Email: blerina@math.uh.edu
More information2 Arithmetic. 2.1 Greatest common divisors. This chapter is about properties of the integers Z = {..., 2, 1, 0, 1, 2,...}.
2 Arithmetic This chapter is about properties of the integers Z = {..., 2, 1, 0, 1, 2,...}. (See [Houston, Chapters 27 & 28]) 2.1 Greatest common divisors Definition 2.16. If a, b are integers, we say
More information2.5 정수와알고리즘 (Integers and Algorithms)
이산수학 () 2.5 정수와알고리즘 (Integers and Algorithms) 2006 년봄학기 문양세강원대학교컴퓨터과학과 Introduction Base-b representations of integers. (b진법표현 ) Especially: binary, hexadecimal, octal. Also, two s complement representation
More informationExercises Exercises. 2. Determine whether each of these integers is prime. a) 21. b) 29. c) 71. d) 97. e) 111. f) 143. a) 19. b) 27. c) 93.
Exercises Exercises 1. Determine whether each of these integers is prime. a) 21 b) 29 c) 71 d) 97 e) 111 f) 143 2. Determine whether each of these integers is prime. a) 19 b) 27 c) 93 d) 101 e) 107 f)
More informationIntermediate Math Circles February 29, 2012 Linear Diophantine Equations I
Intermediate Math Circles February 29, 2012 Linear Diophantine Equations I Diophantine equations are equations intended to be solved in the integers. We re going to focus on Linear Diophantine Equations.
More informationBase-b representations of integers. (b 진법표현 ) Algorithms for computer arithmetic: Euclidean algorithm for finding GCD s.
이산수학 () 정수와알고리즘 (Integers and Algorithms) 2011년봄학기 강원대학교컴퓨터과학전공문양세 Introduction Base-b representations of integers. (b 진법표현 ) Especially: binary, hexadecimal, octal. Also, two s complement representation
More informationAdam Blank Spring 2017 CSE 311. Foundations of Computing I. * All slides are a combined effort between previous instructors of the course
Adam Blank Spring 2017 CSE 311 Foundations of Computing I * All slides are a combined effort between previous instructors of the course HW 3 De-Brief HW 3 De-Brief PROOFS! HW 3 De-Brief Proofs This is
More informationNumber theory (Chapter 4)
EECS 203 Spring 2016 Lecture 10 Page 1 of 8 Number theory (Chapter 4) Review Questions: 1. Does 5 1? Does 1 5? 2. Does (129+63) mod 10 = (129 mod 10)+(63 mod 10)? 3. Does (129+63) mod 10 = ((129 mod 10)+(63
More informationPublic Key Encryption
Public Key Encryption 3/13/2012 Cryptography 1 Facts About Numbers Prime number p: p is an integer p 2 The only divisors of p are 1 and p s 2, 7, 19 are primes -3, 0, 1, 6 are not primes Prime decomposition
More informationWith Question/Answer Animations. Chapter 4
With Question/Answer Animations Chapter 4 Chapter Motivation Number theory is the part of mathematics devoted to the study of the integers and their properties. Key ideas in number theory include divisibility
More informationComputational Number Theory. Adam O Neill Based on
Computational Number Theory Adam O Neill Based on http://cseweb.ucsd.edu/~mihir/cse207/ Secret Key Exchange - * Is Alice Ka Public Network Ka = KB O KB 0^1 Eve should have a hard time getting information
More informationMa/CS 6a Class 1. Course Details
Ma/CS 6a Class 1 By Adam Sheffer Course Details Adam Sheffer. adamsh@caltech.edu 1:00 Monday, Wednesday, and Friday. http://www.math.caltech.edu/~2014-15/1term/ma006a/ 1 Course Structure No exam! Grade
More informationCS483 Design and Analysis of Algorithms
CS483 Design and Analysis of Algorithms Lectures 2-3 Algorithms with Numbers Instructor: Fei Li lifei@cs.gmu.edu with subject: CS483 Office hours: STII, Room 443, Friday 4:00pm - 6:00pm or by appointments
More informationArithmetic Algorithms, Part 1
Arithmetic Algorithms, Part 1 DPV Chapter 1 Jim Royer EECS January 18, 2019 Royer Arithmetic Algorithms, Part 1 1/ 15 Multiplication à la Français function multiply(a, b) // input: two n-bit integers a
More informationMONOALPHABETIC CIPHERS AND THEIR MATHEMATICS. CIS 400/628 Spring 2005 Introduction to Cryptography
MONOALPHABETIC CIPHERS AND THEIR MATHEMATICS CIS 400/628 Spring 2005 Introduction to Cryptography This is based on Chapter 1 of Lewand and Chapter 1 of Garrett. MONOALPHABETIC SUBSTITUTION CIPHERS These
More informationIntroduction to Cryptography. Lecture 6
Introduction to Cryptography Lecture 6 Benny Pinkas page 1 Public Key Encryption page 2 Classical symmetric ciphers Alice and Bob share a private key k. System is secure as long as k is secret. Major problem:
More informationCS2800 Questions selected for fall 2017
Discrete Structures Final exam sample questions Solutions CS2800 Questions selected for fall 2017 1. Determine the prime factorizations, greatest common divisor, and least common multiple of the following
More informationINTEGERS. In this section we aim to show the following: Goal. Every natural number can be written uniquely as a product of primes.
INTEGERS PETER MAYR (MATH 2001, CU BOULDER) In this section we aim to show the following: Goal. Every natural number can be written uniquely as a product of primes. 1. Divisibility Definition. Let a, b
More information2. THE EUCLIDEAN ALGORITHM More ring essentials
2. THE EUCLIDEAN ALGORITHM More ring essentials In this chapter: rings R commutative with 1. An element b R divides a R, or b is a divisor of a, or a is divisible by b, or a is a multiple of b, if there
More information#26: Number Theory, Part I: Divisibility
#26: Number Theory, Part I: Divisibility and Primality April 25, 2009 This week, we will spend some time studying the basics of number theory, which is essentially the study of the natural numbers (0,
More informationMATH 433 Applied Algebra Lecture 4: Modular arithmetic (continued). Linear congruences.
MATH 433 Applied Algebra Lecture 4: Modular arithmetic (continued). Linear congruences. Congruences Let n be a postive integer. The integers a and b are called congruent modulo n if they have the same
More informationPublic Key Cryptography
Public Key Cryptography Spotlight on Science J. Robert Buchanan Department of Mathematics 2011 What is Cryptography? cryptography: study of methods for sending messages in a form that only be understood
More informationNumber theory. Myrto Arapinis School of Informatics University of Edinburgh. October 9, /29
Number theory Myrto Arapinis School of Informatics University of Edinburgh October 9, 2014 1/29 Division Definition If a and b are integers with a 6= 0, then a divides b if there exists an integer c such
More informationOutline. Some Review: Divisors. Common Divisors. Primes and Factors. b divides a (or b is a divisor of a) if a = mb for some m
Outline GCD and Euclid s Algorithm AIT 682: Network and Systems Security Topic 5.1 Basic Number Theory -- Foundation of Public Key Cryptography Modulo Arithmetic Modular Exponentiation Discrete Logarithms
More informationOutline. AIT 682: Network and Systems Security. GCD and Euclid s Algorithm Modulo Arithmetic Modular Exponentiation Discrete Logarithms
AIT 682: Network and Systems Security Topic 5.1 Basic Number Theory -- Foundation of Public Key Cryptography Instructor: Dr. Kun Sun Outline GCD and Euclid s Algorithm Modulo Arithmetic Modular Exponentiation
More informationDirect Proof Divisibility
Direct Proof Divisibility Lecture 15 Section 4.3 Robb T. Koether Hampden-Sydney College Fri, Feb 8, 2013 Robb T. Koether (Hampden-Sydney College) Direct Proof Divisibility Fri, Feb 8, 2013 1 / 20 1 Divisibility
More informationLinear Congruences. The equation ax = b for a, b R is uniquely solvable if a 0: x = b/a. Want to extend to the linear congruence:
Linear Congruences The equation ax = b for a, b R is uniquely solvable if a 0: x = b/a. Want to extend to the linear congruence: ax b (mod m), a, b Z, m N +. (1) If x 0 is a solution then so is x k :=
More informationCMPUT 403: Number Theory
CMPUT 403: Number Theory Zachary Friggstad February 26, 2016 Outline Factoring Sieve Multiplicative Functions Greatest Common Divisors Applications Chinese Remainder Theorem Factoring Theorem (Fundamental
More informationAlgorithms (II) Yu Yu. Shanghai Jiaotong University
Algorithms (II) Yu Yu Shanghai Jiaotong University Chapter 1. Algorithms with Numbers Two seemingly similar problems Factoring: Given a number N, express it as a product of its prime factors. Primality:
More informationWednesday, February 21. Today we will begin Course Notes Chapter 5 (Number Theory).
Wednesday, February 21 Today we will begin Course Notes Chapter 5 (Number Theory). 1 Return to Chapter 5 In discussing Methods of Proof (Chapter 3, Section 2) we introduced the divisibility relation from
More informationMathematics for Computer Science Exercises for Week 10
Mathematics for Computer Science Exercises for Week 10 Silvio Capobianco Last update: 7 November 2018 Problems from Section 9.1 Problem 9.1. Prove that a linear combination of linear combinations of integers
More information4 Powers of an Element; Cyclic Groups
4 Powers of an Element; Cyclic Groups Notation When considering an abstract group (G, ), we will often simplify notation as follows x y will be expressed as xy (x y) z will be expressed as xyz x (y z)
More informationIntermediate Math Circles February 26, 2014 Diophantine Equations I
Intermediate Math Circles February 26, 2014 Diophantine Equations I 1. An introduction to Diophantine equations A Diophantine equation is a polynomial equation that is intended to be solved over the integers.
More informationAlgorithms CMSC Basic algorithms in Number Theory: Euclid s algorithm and multiplicative inverse
Algorithms CMSC-27200 Basic algorithms in Number Theory: Euclid s algorithm and multiplicative inverse Instructor: László Babai Last updated 02-14-2015. Z denotes the set of integers. All variables in
More informationCSC 474 Network Security. Outline. GCD and Euclid s Algorithm. GCD and Euclid s Algorithm Modulo Arithmetic Modular Exponentiation Discrete Logarithms
Computer Science CSC 474 Network Security Topic 5.1 Basic Number Theory -- Foundation of Public Key Cryptography CSC 474 Dr. Peng Ning 1 Outline GCD and Euclid s Algorithm Modulo Arithmetic Modular Exponentiation
More informationCSE20: Discrete Mathematics
Spring 2018 Today Greatest Common Divisor (GCD) Euclid s algorithm Proof of Correctness Reading: Chapter 4.3 Primes and GCD Universe: U = N = {0, 1, 2,...} a divides b (written a b) iff k.b = ak Set of
More informationFinite Fields. Mike Reiter
1 Finite Fields Mike Reiter reiter@cs.unc.edu Based on Chapter 4 of: W. Stallings. Cryptography and Network Security, Principles and Practices. 3 rd Edition, 2003. Groups 2 A group G, is a set G of elements
More informationGreatest Common Divisor MATH Greatest Common Divisor. Benjamin V.C. Collins, James A. Swenson MATH 2730
MATH 2730 Greatest Common Divisor Benjamin V.C. Collins James A. Swenson The world s least necessary definition Definition Let a, b Z, not both zero. The largest integer d such that d a and d b is called
More informationIntroduction to Sets and Logic (MATH 1190)
Introduction to Sets and Logic () Instructor: Email: shenlili@yorku.ca Department of Mathematics and Statistics York University Nov 13, 2014 Quiz announcement The second quiz will be held on Thursday,
More informationMa/CS 6a Class 2: Congruences
Ma/CS 6a Class 2: Congruences 1 + 1 5 (mod 3) By Adam Sheffer Reminder: Public Key Cryptography Idea. Use a public key which is used for encryption and a private key used for decryption. Alice encrypts
More informationNumber theory (Chapter 4)
EECS 203 Spring 2016 Lecture 12 Page 1 of 8 Number theory (Chapter 4) Review Compute 6 11 mod 13 in an efficient way What is the prime factorization of 100? 138? What is gcd(100, 138)? What is lcm(100,138)?
More informationThe RSA Cryptosystem: Factoring the public modulus. Debdeep Mukhopadhyay
The RSA Cryptosystem: Factoring the public modulus Debdeep Mukhopadhyay Assistant Professor Department of Computer Science and Engineering Indian Institute of Technology Kharagpur INDIA -721302 Objectives
More informationICS141: Discrete Mathematics for Computer Science I
ICS141: Discrete Mathematics for Computer Science I Dept. Information & Computer Sci., Jan Stelovsky based on slides by Dr. Baek and Dr. Still Originals by Dr. M. P. Frank and Dr. J.L. Gross Provided by
More information18 Divisibility. and 0 r < d. Lemma Let n,d Z with d 0. If n = qd+r = q d+r with 0 r,r < d, then q = q and r = r.
118 18. DIVISIBILITY 18 Divisibility Chapter V Theory of the Integers One of the oldest surviving mathematical texts is Euclid s Elements, a collection of 13 books. This book, dating back to several hundred
More informationRemainders. We learned how to multiply and divide in elementary
Remainders We learned how to multiply and divide in elementary school. As adults we perform division mostly by pressing the key on a calculator. This key supplies the quotient. In numerical analysis and
More informationCongruence Classes. Number Theory Essentials. Modular Arithmetic Systems
Cryptography Introduction to Number Theory 1 Preview Integers Prime Numbers Modular Arithmetic Totient Function Euler's Theorem Fermat's Little Theorem Euclid's Algorithm 2 Introduction to Number Theory
More informationDiscrete Mathematics and Probability Theory Fall 2018 Alistair Sinclair and Yun Song Note 6
CS 70 Discrete Mathematics and Probability Theory Fall 2018 Alistair Sinclair and Yun Song Note 6 1 Modular Arithmetic In several settings, such as error-correcting codes and cryptography, we sometimes
More informationEUCLID S ALGORITHM AND THE FUNDAMENTAL THEOREM OF ARITHMETIC after N. Vasiliev and V. Gutenmacher (Kvant, 1972)
Intro to Math Reasoning Grinshpan EUCLID S ALGORITHM AND THE FUNDAMENTAL THEOREM OF ARITHMETIC after N. Vasiliev and V. Gutenmacher (Kvant, 1972) We all know that every composite natural number is a product
More informationQ 2.0.2: If it s 5:30pm now, what time will it be in 4753 hours? Q 2.0.3: Today is Wednesday. What day of the week will it be in one year from today?
2 Mod math Modular arithmetic is the math you do when you talk about time on a clock. For example, if it s 9 o clock right now, then it ll be 1 o clock in 4 hours. Clearly, 9 + 4 1 in general. But on a
More informationECE 646 Lecture 5. Motivation: Mathematical Background: Modular Arithmetic. Public-key ciphers. RSA keys. RSA as a trap-door one-way function
ECE Lecture 5 Mathematical Background: Modular Arithmetic Motivation: Public-key ciphers RSA as a trap-door one-way function PUBLIC KEY message ciphertext M C = f(m) = M e mod N C RSA keys PUBLIC KEY PRIVATE
More informationIntroduction to Public-Key Cryptosystems:
Introduction to Public-Key Cryptosystems: Technical Underpinnings: RSA and Primality Testing Modes of Encryption for RSA Digital Signatures for RSA 1 RSA Block Encryption / Decryption and Signing Each
More information