Lecture 4
Lecture 4
Chapter 4
Number Theory and
Cryptography
歐亞書局
4.1 Divisibility and Modular Arithmetic
4.2 Integer Representations and Algorithms
4.3 Primes and Greatest Common Divisors
4.4 Solving Congruences
4.5 Applications of Congruences
4.6 Cryptography
歐亞書局 P. 167
4.1 Divisibility and Modular
Arithmetic
• Definition 1:
– a and b are integers with a = 0
– We say that a divides b if there is an integer c
such that b = ac
– Equivalently, b/a is an integer
– a is a factor or divisor of b
– b is a multiple of a
– Denoted by a | b
Example
• Let n and d be positive integers. How
many positive integers not exceeding n are
divisible by d?
Theorem 1
• Let a, b, and c be integers, where a = 0.
Then
– (i) if a | b and a | c, then a | (b + c);
– (ii ) if a | b, then a | bc for all integers c;
– (iii ) if a | b and b | c, then a | c.
Corollary 1
• If a, b, and c are integers,
• where a = 0,
• such that a | b and a | c,
• then a | mb + nc whenever m and n are
integers.
The Division Algorithm
• Theorem 2
– Let a be an integer
– and d a positive integer.
– Then there are unique integers q and r, with
0 ≤ r < d,
– such that a = dq + r.
Definition 2
• In the equality given in the division
algorithm, d is called the divisor, a is called
the dividend, q is called the quotient, and r
is called the remainder. This notation is
used to express the quotient and
remainder:
• q = a div d
• r = a mod d
Example
• What are the quotient and remainder
when −11 is divided by 3?
• −11 = 3(−4) + 1
• −11 = 3(−3) − 2
• 13 11 4 4 22 15
•N L E E W P
•E C V V N G
•4 2 21 21 13 6
•2 0 19 19 11 4
•C A T T L E
Two Types of Cipher
• Monoalphabetic or Character Cipher
– Shift Cipher
– Affine Cipher
• Block Cipher
– Transposition Cipher
Example
• Using the transposition cipher based on
the permutation σ of the set {1, 2, 3, 4}
• with σ(1) = 3, σ(2) = 1, σ(3) = 4, and σ(4) = 2