Number Theory: MTK3013 Discrete Structures
Number Theory: MTK3013 Discrete Structures
my
NUMBER THEORY
MTK3013
DISCRETE STRUCTURES
1
http://fskik.upsi.edu.my
2
http://fskik.upsi.edu.my
Section 3.4
3
http://fskik.upsi.edu.my
Division
If a and b are integers with a 0, we say that
a divides b if there is an integer c so that b = ac.
4
http://fskik.upsi.edu.my
Divisibility Theorems
For integers a, b, and c it is true that
• if a | b and a | c, then a | (b + c)
Example: 3 | 6 and 3 | 9, so 3 | 15.
• if a | b and b | c, then a | c
Example: 4 | 8 and 8 | 24, so 4 | 24.
5
http://fskik.upsi.edu.my
6
http://fskik.upsi.edu.my
-11 = 3(-4) + 1.
17 = 53 + 2.
• 17 is the dividend,
• 5 is the divisor,
• 3 is called the quotient, and
• 2 is called the remainder.
8
http://fskik.upsi.edu.my
Modular Arithmetic
• If a is an integer and m a positive integer, a
mod m is the remainder when a is divided by
m.
• If a = qm + r and 0 r < m, then a mod m
=r
• Example: Find 17 mod 5.
• Example: Find 133 mod 9.
9
http://fskik.upsi.edu.my
Modular Arithmetic
Let a be an integer and m be a positive integer.
We denote by a mod m the remainder when a is divided
by m.
Examples:
9 mod 4 = 1
9 mod 3 = 0
9 mod 10 = 9
-13 mod 4 = 3
10
http://fskik.upsi.edu.my
Applications of Modular
Arithmetic
• Hashing functions
• Pseudorandom number generation
• Cryptography
11
http://fskik.upsi.edu.my
Section 3.5
12
http://fskik.upsi.edu.my
Primes
A positive integer p greater than 1 is called prime if the
only positive factors of p are 1 and p.
13
http://fskik.upsi.edu.my
Primes
Examples:
15 = 3·5
48 = 2·2·2·2·3 = 24·3
17 = 17
512 = 2·2·2·2·2·2·2·2·2 = 29
515 = 5·103
28 = 2·2·7 = 22·7
14
http://fskik.upsi.edu.my
Primes
If n is a composite integer, then n has a prime divisor less
than or equal .
16
http://fskik.upsi.edu.my
Example: a = 60 = 22 31 51
b = 54 = 21 33 50
gcd(a, b) = 21 31 50 = 6
Examples:
Are 15 and 28 relatively prime?
Yes, gcd(15, 28) = 1.
Are 55 and 28 relatively prime?
Yes, gcd(55, 28) = 1.
Are 35 and 28 relatively prime?
No, gcd(35, 28) = 7.
Are 17 and 22 are relatively prime?
18
http://fskik.upsi.edu.my
Examples:
Are 15, 17, and 27 pairwise relatively prime?
No, because gcd(15, 27) = 3.
Are 15, 17, and 28 pairwise relatively prime?
Yes, because gcd(15, 17) = 1, gcd(15, 28) = 1 and gcd(17, 28) = 1.
19
http://fskik.upsi.edu.my
lcm(4, 6) =
lcm(5, 10) =
20
http://fskik.upsi.edu.my
Example: a = 60 = 22 31 51
b = 54 = 21 33 50
b = 54 = 21 33 50
gcd(a, b) = 21 31 50 =6
lcm(a, b) = 22 33 51 = 540
22
http://fskik.upsi.edu.my
23
http://fskik.upsi.edu.my
So we divide 14 by 7:
14 = 72 + 0
We find that 7 | 14, and thus gcd(14, 7) = 7.
Example
• Find the greatest common divisor of 414 and 662 using the
Euclidean algorithm.
26
http://fskik.upsi.edu.my
27
http://fskik.upsi.edu.my
28
http://fskik.upsi.edu.my
Example
Express gcd (252,198) = 18 as linear combination of 252 and 198.
54 = 1. 36 + 18 18 = 54 – 1. 36
36 = 2. 18 + 0
18 = 54 – 1. 36
= 54 - 1. (198 – 3.54)
= 54 – 1. 198 + 3. 54
= 4. 54 – 1.198
= 4. (252 – 1. 198) – 1.198
= 4. 252 - 4. 198 – 1.198
= 4. 252 – 5. 198
29