0% found this document useful (0 votes)
6 views15 pages

Lecture 02

Uploaded by

62821
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views15 pages

Lecture 02

Uploaded by

62821
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

• One of the basic

techniques of number
Euclidean theory

Algorithm • Procedure for


determining the greatest
common divisor of two
positive integers

• Two integers are


relatively prime if their
only common positive
integer factor is 1

1
Greatest Common Divisor
(GCD)
• The greatest common divisor of a and b is the largest
integer that divides both a and b
• We can use the notation gcd(a,b) to mean the
greatest common divisor of a and b
• We also define gcd(0,0) = 0
• Positive integer c is said to be the gcd of a and b if:
• c is a divisor of a and b
• Any divisor of a and b is a divisor of c

• An equivalent definition is:


gcd(a,b) = max[k, such that k | a and k | b]
2
GCD
• Because we require that the greatest common divisor be positive,
gcd(a,b) = gcd(a,‐b) = gcd(‐a,b) = gcd(‐a,‐b)

• In general, gcd(a,b) = gcd(| a |, | b |)


gcd(60, 24) = gcd(60, ‐ 24) = 12

• Also, because all nonzero integers divide 0, we have gcd(a,0) = | a |


• We stated that two integers a and b are relatively prime if their
only common positive integer factor is 1; this is equivalent to
saying that a and b are relatively prime if gcd(a,b) = 1
8 and 15 are relatively prime because the positive divisors of 8 are 1, 2, 4, and
8, and the positive divisors of 15 are 1, 3, 5, and 15. So 1 is the only integer on
both lists.
3
4
Example GCD(1970,1066)
1970 = 1 x 1066 + 904 gcd(1066, 904)
1066 = 1 x 904 + 162 gcd(904, 162)
904 = 5 x 162 + 94 gcd(162, 94)
162 = 1 x 94 + 68 gcd(94, 68)
94 = 1 x 68 + 26 gcd(68, 26)
68 = 2 x 26 + 16 gcd(26, 16)
26 = 1 x 16 + 10 gcd(16, 10)
16 = 1 x 10 + 6 gcd(10, 6)
10 = 1 x 6 + 4 gcd(6, 4)
6=1x4+2 gcd(4, 2)
4=2x2+0 gcd(2, 0)

5
6
Table 2.1
Euclidean Algorithm Example

7
The Modulus
• If a is an integer and n is a positive
integer, we define a mod n to be the
remainder when a is divided by n. The
integer n is called the modulus.

11 mod 7 = 4 ; -11 mod 7 = 3

24
Congruent Modulo
• Two integers a and b are said to be
congruent modulo n, if
(a mod n) = (b mod n).
• Therefore,
a Ξ b (mod n) could be written as:

a mod n = b mod n

24
Properties of Congruence
• Congruence have the following properties:

1. a Ξ b (mod n) if n | (a – b)

2. a Ξ b (mod n) implies b Ξ a (mod n)

3. a Ξ b (mod n) and b Ξ c (mod n) imply that


a Ξ c (mod n)

24
Modular Arithmetic
• Modular arithmetic exhibits the following
properties:
1. [(a mod n) + (b mod n)] mod n = (a + b) mod n

2. [(a mod n) ‐ (b mod n)] mod n = (a ‐ b) mod n

3. [(a mod n) * (b mod n)] mod n = (a * b) mod n

24
Remaining Properties:
• Examples of the three remaining properties:

11 mod 8 = 3; 15 mod 8 = 7
[(11 mod 8) + (15 mod 8)] mod 8 = 10 mod 8 = 2
(11 + 15) mod 8 = 26 mod 8 = 2
[(11 mod 8) - (15 mod 8)] mod 8 = - 4 mod 8 = 4
(11 - 15) mod 8 = - 4 mod 8 = 4
[(11 mod 8) * (15 mod 8)] mod 8 = 21 mod 8 = 5
(11 * 15) mod 8 = 165 mod 8 = 5

25
Arithmetic Modulo 8
Table 2.2(a) Addition Modulo 8
Table 2.2(b)
Multiplication Modulo 8
Table 2.2(c)

Additive
and
Multiplicative
Inverse
Modulo 8
28

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy