Lecture02
Lecture02
techniques of number
Euclidean theory
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
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.
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)
24
Modular Arithmetic
• Modular arithmetic exhibits the following
properties:
1. [(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