You are on page 1of 27

Discrete Mathematics

and Its Applications


Sixth Edition
By Kenneth Rosen

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

• Which one should we use?


Modular Arithmetic
• Definition 3
– If a and b are integers and m is a positive
integer, then a is congruent to b modulo m if m
divides a − b. We use the notation a ≡ b (mod m)
to indicate that a is congruent to b modulo m.
We say that a ≡ b (mod m) is a congruence and
that m is its modulus (plural moduli). If a and b
are not congruent modulo m, we write
a ≡ b (mod m).
Difference between
a≡ b (mod m) and a mod m = b
• a ≡ b (mod m)
– represents a relation on the set of integers
• a mod m = b
– represents a function
Theorem 3
• Let a and b be integers,
• and let m be a positive integer.
• Then a ≡ b (mod m) if and only if
a mod m = b mod m.
Theorem 4
• Let m be a positive integer.
• The integers a and b are congruent modulo
m if and only if
• There is an integer k
• such that a = b + km.
Theorem 5
• Let m be a positive integer.
• If a ≡ b (mod m) and c ≡ d (mod m), then
• a + c ≡ b + d (mod m) and ac ≡ bd (mod m).
Corollary 2
• Let m be a positive integer
• and let a and b be integers. Then
• (a + b) modm = ((a mod m) + (b mod m)) modm
• and ab modm = ((a mod m)(b mod m)) mod m.
Arithmetic Modulo m
• 𝑍𝑚 = 0, 1, 2, 3, … , 𝑚 − 1
• 𝑎 +𝑚 𝑏 = 𝑎 + 𝑏 𝒎𝒐𝒅 𝑚
• 𝑎.𝑚 𝑏 = 𝑎. 𝑏 𝒎𝒐𝒅 𝑚
Properties
• Closure
• Associativity
• Commutativity
• Identity elements
• Additive inverses
• Distributivity
4.3 Prime
• Definition 1:
– An integer p greater than 1 is called prime if
the only positive factors of p are 1 and p. A
positive integer that is greater than 1 and is
not prime is called composite.
Theorem 1
• THE FUNDAMENTAL THEOREM OF
ARITHMETIC
– Every integer greater than 1 can be written
uniquely as a prime or as the product of two
or more primes where the prime factors are
written in order of non decreasing size.
Theorem 2
• If n is a composite integer, then n has a
prime divisor less than or equal to √n.
Example
• Show that 101 is prime.
The Sieve of Eratosthenes
Theorem 3
• There are infinitely many primes.
Theorem 4
• THE PRIME NUMBER THEOREM
– The ratio of the number of primes not
exceeding x and x/ ln x approaches 1 as x
grows without bound.

You might also like