chapter 2 number theory, number system & computer arithmetic, cryptography by miss farah adibah...
TRANSCRIPT
CHAPTER 2NUMBER THEORY,
NUMBER SYSTEM & COMPUTER
ARITHMETIC, CRYPTOGRAPHY
BY MISS FARAH ADIBAH ADNANIMK
CHAPTER OUTLINE - I
• 2.1 INTRODUCTION TO NUMBER THEORY2.1.1 DIVISIBILITY
• PRIME NUMBERS • FACTORIZATION
2.1.2 GREATEST COMMON DIVISOR (GCD)• EUCLIDEAN ALGORITHM
2.1.3 MODULAR ARITHMETIC
• 2.2 NUMBER SYSTEM & COMPUTER ARITHMETIC• 2.3 CRYPTOGRAPHY
2.1 INTRODUCTION TO NUMBER THEORY • The theory of number is part of discrete
mathematics and involving the integers and their properties.
• The concept of division of integers is fundamental to computer arithmetic.
• This chapter involves algorithms – used to solves many problems; searching a list, sorting finding the shortest path, find greatest common divisor, etc.
2.1.1 DIVISIBILITY• Number theory is concerned with the properties
of integers.
• One of the most important is divisibility.
Definition 2.1
Let and be integers with We say that
divides if there is an integer such that
This is denoted by Another way to
express this is that
is a multiple of .
a b .0a
a b k
.akb .| ba
and offactor a is ba b
a
EXAMPLE 2.1Determine whether they are divisible or not.
a) .
b) .
c) .
15|3
60|1518|7
Basic Properties of Divisibility
Let represent integers. Then
i. .
ii..
iii..
cba ,,
. then , and | If cbacaba
. integers allfor ,b then | If ccaba
.c then , and | If acbba
2.1.1.1 PRIME NUMBERSDefinition 2.2
A number that is divisible only by 1 and itself is called prime number. An integer that is not prime is called composite, which means that must expressible as a product of integers with
1n
n ab.1 nab
1p
EXAMPLE 2.2Determine each number is prime number or not.
a)7
b)9
2 3 5 7 11 13 17 19 23
29 31 37 41 43 47 53 59 61 67
71 73 79 83 89 97 101 103 107 109
113 127 131 137 139 149 151 157 163 167
173 179 181 191 193 197 199 211 223 227
229 233 239 241 251 257 263 269 271 277
281 283 293 307 311 313 317 331 337 347
349 353 359 367 373 379 383 389 397 401
409 419 421 431 433 439 443 449 457 461
463 467 479 487 491 499 503 509 521 523
541 547 557 563 569 571 577 587 593 599
601 607 613 617 619 631 641 643 647 653
659 661 673 677 683 691 701 709 719 727
733 739 743 751 757 761 769 773 787 797
809 811 821 823 827 829 839 853 857 859
863 877 881 883 887 907 911 919 929 937
941 947 953 967 971 977 983 991 997
The first 1000 primes are listed below.
2.1.1.2 FACTORIZATION
• Theorem 2.1: The Fundamental Theorem of Arithmetic
• Any integer is a product of primes uniquely, up to the order of primes. It can be factored in a unique way as:
where are prime numbers and
1a
ttpppa ...21
21
tppp ...21
0i
EXAMPLE 2.3Find prime factorizations of:
a)91
b)11011
Definition 2.3
• The greatest common divisor of and is the largest positive integer dividing both and and is denoted by either . When
, we say and are relatively primes.
2.1.2 GREATEST COMMON DIVISOR (GCD)
a ba b
ba, gcda b 1, gcd ba
Steps to Find the Gcd• If you can factor and into primes, do so.
For each prime number, look at the powers that it appears in the factorizations of and . Take the smaller of the two. Put these prime powers together to get the gcd. This is easiest understand by examples:
gcd (576,135) =
a b
a b
,32576 i) 26
,53135 323 9
ii) gcd
Note that if prime does not appear in factorization, then it cannot appear in the gcd.
• Suppose and are large numbers, so it might not be easy to factor them. The gcd can be calculated by a procedure known as the Euclidean algorithm. It goes back to what everyone learned in grade school: division with remainder.
,732( 245 .2872)7532,752 200235
Steps to Find the Gcd
• Suppose that is greater than . If not, switch
and . The first step is divide the larger of the two integers by the smaller; let is larger than , hence represent in the form
Where is called the dividend, is called the divisor, is called the quotient, and is called the remainder.
2.1.2.1 THE EUCLIDEAN ALGORITHM
a b
a b
ab a
11 rbqa a b
1q 1r
• If then continue by representing in
the form
• Continue this way until the remainder that is
zero.
2.1.2.1 THE EUCLIDEAN ALGORITHM
,01 r b
.22 rbqb
• The following sequence of steps:
•Hence, the greatest common divisor is the last nonzero remainder in the sequence of divisions
krba ),gcd(
0 ar . 1 br • Let and
• There are two important aspects to this algorithm:
It does not require factorization of the
numbers. It is fast.
EXAMPLE 2.4Compute . 1180,482gcd
• Sometimes we care about the remainder of an integer when it is divided by some specified positive integer.
Definition 2.4
Let be a fixed positive integer. For any integer
, is the remainder upon dividing by
.
Eg:
2.1.3 MODULAR ARITHMETIC
a
n
ana mod
n
8 mod 3 2
• One of the most basic and useful in number theory is modular arithmetic, or known as congruence.
Definition 2.5
If and are integers and is a positive integer, then and are said to be congruent modulo if . This is written
.
2.1.3 MODULAR ARITHMETIC
a b na b
) mod () mod ( nbna ) mod( nba
a) Determine whether 32 is congruent to 7 modulo 5.
EXAMPLE 2.5
2.1.3.1 PROPERTIES OF MODULO OPERATOR.
To demonstrate the first point, if then
for some So we can write
)( if mod bannba
nbanbna mod implies )mod() mod (
nabnba mod implies mod ncancbnba mod implies mod implies mod
ban knba )(
.k .knba
a) .
b) .
EXAMPLE 2.6)5(mod823 )8(mod511
2.1.3.2 MODULAR ARITHMETIC OPERATIONS.
• Given . Prove the properties above.
EXAMPLE 2.778mod15 and 38mod11