Lecture 12 Number Theory
Lecture 12 Number Theory
1
Divisibility and Modular Arithmetic
Division
When one integer is divided by a second nonzero integer, the
quotient may or may not be an integer.
For example, 12/3 = 4 is an integer, whereas 11/4 = 2.75 is not. This
leads to Definition 1.
2
3
4
The Division Algorithm
5
Example
What are the quotient and remainder when 101 is divided by 11?
Solution: We have
101 = 11 ・ 9 + 2.
Hence, the quotient when 101 is divided by 11 is 9 = 101 div 11,
and the remainder is
2 = 101 mod 11.
6
Example
7
Example
Solution: We have
−11 = 3(−4) + 1.
Hence, the quotient when −11 is divided by 3 is −4 = −11 div 3,
and the remainder is
1 = −11 mod 3.
Note that the remainder cannot be negative. Consequently, the
remainder is not −2, even though −11 = 3(−3) − 2, because r = −2
does not satisfy 0 ≤ r < 3.
Note that the integer a is divisible by the integer d if and only if the
remainder is zero
when a is divided by d.
8
Modular Arithmetic
9
Congruence
10
Congruence
11
Congruence
12
Arithmetic Modulo m
13
Example
14
Example
15
Modular Exponentiation
16
Example
17
Primes and Greatest Common Divisors
18
Primes
19
Trial Division
20
Example
21
22
Greatest Common Divisors
The largest integer that divides both of two integers is called the
greatest common divisor of these integers
23
GCD
24
Reference
Richard Johnsonbaugh. Discrete Mathematics, Pearson; 8th edition (March 16, 2017).
ISBN-10: 0321964683.
25