PRIME NUMBERS �
312706023 何忻
4.3
The Division Algorithm:
OUTLINE
Prime & Composite number
Division algorithms
Digit represent in computer
DEFINITION 4.1
(不存在除了自己或 1 之外的因數)
a mod b = 0_
1
THEOREM 4.3
(a) 1|a and a|0.
(b) [(a|b) ∧ (b|a)] ⟹ a = ± b.
(c) [(a|b) ∧ (b|c)] ⟹ a|c.
(d) a|b ⟹ a|bx, for all x ∈ Z.
(e) If x = y + z, for x, y, z ∈ Z, and a divides two of the three integer x, y, z, then a divides the remaining integer.
(f) [(a|b) ∧ (a|c)] ⟹ a|(bx + cy), for all 𝑥, y ∈ Z.
(The expression bx + cy is called a linear combination of b, c.)
(g) For 1 ≤ i ≤ n, let ci ∈ Z. If a divides each ci , then a|( c1x1+c2x2 + … + cnxn ), where 𝑥𝑖 ∈ Z , 1 ≤ i ≤ n.
2
(The expression bx + cy is called a linear combination of b, c.)
3
1. If a|b and a|c, then b = am and c = an, for some m, n ∈ Z.
2. So bx + cy = (am)x + (an)y = a(mx + ny)
Part (f):
Proof
Since bx + cy = a(mx + ny), with mx + ny ∈ Z
⟹ It follows that a|(bx + cy)
EXAMPLE 4.23
4
Step 1: Since 3|6 and 3|9 and 3|15
Step 2: 3 is a divisor of 6x + 9y + 15z
Step 3: 3 is a divisor of 107 (?)
(g) For 1 ≤ i ≤ n, let ci ∈ Z. If a divides each ci ,
then a|( c1x1+c2x2 + … + cnxn ), where 𝑥𝑖 ∈ Z , 1 ≤ i ≤ n.
NO!
So there doesn’t exist such integers x, y, z
EXAMPLE 4.24
5
Step 1: 17 | (2a + 3b) ⟹ 17 | (−4)∗(2a + 3b)
Step 2: 17 | (17a + 17b)
Step 3: 17 | [(17a + 17b) + (−4)∗(2a + 3b)]
⟹ 17 | 9a + 5b
(d) a|b ⟹ a|bx, for all x ∈ Z.
(f) [(a|b) ∧ (a|c)] ⟹ a|(bx + cy), for all 𝑥, y ∈ Z.
(e) If x = y + z, for x, y, z ∈ Z, and a divides two of the three integer x, y, z, then a divides the remaining integer.
LEMMA 4.1
If n ∈ 𝐙+ and n is composite,
then there is a prime p such that p|n
Proof
(d) a|b ⟹ a|bx, for all x ∈ Z.
與 m 的假設相互矛盾 ⟹ 可知 S = ∅
必定存在質數 p 可整除 n
6
THEOREM 4.4 EUCLID
Proof
但不可能有pj 可整除1 ⟹ 與假設相互矛盾
有無限多的質數存在
(e) If x = y + z, for x, y, z ∈ Z, and a divides two of the three integer x, y, z, then a divides the remaining integer.
By LEMMA 4.1
7
with a = qb + r, 0 ≤ r < b.
THEOREM 4.5 THE DIVISION ALGORITHM
UNIQUENESS唯一性
EXISTENCE
存在性
⟹ so consider the case b does not divide a.
8
Proof
Existence 存在性
Step 1: Let S = {a – tb| t ∈ Z, a – tb > 0} ⊂ 𝐙+.
(a) If a > 0, let t = 0 ⟹ a ∈ S and S ≠ ∅
(b) If a ≤ 0, let t = a – 1 ⟹ a – tb
= a – (a – 1)b = a(1 – b) + b
Step 2: Because b ≥ 1 ⟹ (1 – b) ≤ 0 ⟹ a(1 – b) ≥ 0
⟹ a – tb = a(1 – b) + b > 0 and S ≠ ∅.
Hence, for any a ∈ Z, S is a nonempty subset of 𝐙+.
By WOP, S has a least element r, where 0 < r = a – qb, for some q ∈ Z.
(c) If r = b, then a = (q+1)b ⟹ b|a.
(d) If r > b, then r = b + c, for some c ∈ 𝐙+.
⟹ a – qb = r = b + c ⟹ c = a – (q+1)b ∈ S
This now establishes a quotient q and remainder r, 0 ≤ r < b, for the theorem.
與初始前提相互矛盾
符合形式 a – tb
9
Proof
Uniqueness 唯一性
Step 1: Suppose there are q1, q2, r1, r2 ∈ Z
with a = q1 b + r1 , 0 ≤ r1 < b and a = q2 b + r2, 0 ≤ r2 < b
Step 2: Then q1 b + r1 = q2 b + r2
⟹ b ∙ |q1 – q2 | = |r2 – r1| < b
(∵ 0 ≤ r1 , r2 < b )
10
Step 1: 2 * 7 = 7 + 7 = 14
Step 2: 3 * 7 = (2 + 1)* 7 = 2 * 7 + 1* 7
= (7 + 7 ) + 7 = 21
Step 3: 4 * 7 = (3 + 1)* 7 = 3 * 7 + 1* 7
= ((7 + 7 ) + 7) + 7 = 21 + 7= 28
EXAMPLE 4.26
Repeated addition
11
Step 1: 37 - 8 = 29 ≥ 8
Step 2: 29 - 8 = (37 - 8) - 8 = 37 - (2・8) = 21 ≥ 8
Step 3: 21 - 8 = ((37 - 8) - 8) - 8 = 37 - (3・8) = 13 ≥ 8
Step 4: 13 - 8 = (((37 - 8) - 8) - 8) -8 = 37 - (4・8)
= 5 < 8
EXAMPLE 4.26
Repeated subtraction
q = 4, r = 5
12
6137
8
767
8
95
11
8
1
8
0
1
7
7
3
1
6137 = (13771)8
Remainders
Nonnegative integers r0, r1, r2, … rk, with 0 < rk < 8
⟹ such that 6137 = (rk … r2r1r0)8
r4
r3
r2
r1
r0
Remainders
Concept
以此類推
EXAMPLE 4.27
8
13
13,874,945
16
867,184
16
54,199
16
3,387
16
211
16
1
0
7
11 (= B)
3
13 (= D)
13
16
0
EXAMPLE 4.28
Remainders
r4
r3
r2
r1
r0
r5
13,874,945 = (D3B701)16
14
1010 | 0001 | 0011 | 1111 |
A | 1 | 3 | F |
EXAMPLE 4.28
(A13F)16 = (1010000100111111)2
15
EXAMPLE 4.29
1’s complement of |n| | 2’s complement of n |
Replace each 0/1 in the binary represented of |n| by 1/0 | Add 1 too the result in 1’s complement |
Step 1: Start with binary representation of 6.
Step 2: Interchange the 0/1
⟹ the result is 1’s complement of 0110.
Step 3: Add 1 to be the prior result.
6 ⟹ 0110
1001
1010
16
EXAMPLE 4.29
非負整數始於0
非負整數的 2 補數
= 直接轉換成二進制
負整數的 2 補數
⟹ 取其絕對值的 1 補數
⟹ 再加上 1
17
Step 1: 33 – 15 = 33 + (-15)
Step 2: 33 = (00100001)2
Step 3: 15 = (00001111)2
Step 4: -15 = 11110000 + 00000001 = 11110001
Step 5:
00100001
11110001
+
100010010
Discarded
EXAMPLE 4.30
Step 6: (00010010)2 =18
18
01110101
01011000
+
11001101
117
88
+
EXAMPLE 4.30
It means the ans is negative!
Range of N bits [−2N−1, 2N−1 − 1]
19
EXAMPLE 4.31
Proof
By LEMMA 4.1
20