Discrete Mathematics: Theory of Numbers
Discrete Mathematics: Theory of Numbers
Discrete Mathematics: Theory of Numbers
Theory of Numbers
Theory of Numbers
Part 3
Primes
Examples.
100 = 22 52
641 = 641
999 = 33 37
1024 = 210
17 = 171
Primes.
Inductive proof
Case II : n is composite
n = p1m1 p2m2 p3 m3 p4 m4 …. pr mr
Definition
In mathematics, the Greatest Common
Divisor (GCD) of two or more integers, when
at least one of them is not zero, is the
largest positive integer that divides the
numbers without a remainder.
Euclidean Algorithm
Let a = 540, b = 168
We can write: (in division algorithm style)
540 = 168 * 3 + 36
168 = 36 * 4 + 24
36 = 24 * 1 + 12
24 = 12 * 2 + 0 Stop when remainder is 0,
i.e., when the remainder
divides the difference
Greatest Common Divisors
gcd (540,168) =
gcd (168,36) =
gcd (36, 24) =
gcd ( 24, 12) = 12
Greatest Common Divisors
Theorem
GCD of two integers a and b can be expressed as (ax
+ by) where x and y are some integers.
540 = 168 * 3 + 36
168 = 36 * 4 + 24
36 = 24 * 1 + 12
24 = 12 * 2 + 0
Greatest Common Divisors
540 = 168 * 3 + 36
168 = 36 * 4 + 24
36 = 24 * 1 + 12 12 = 36 – 24 * 1
24 = 12 * 2 + 0
Greatest Common Divisors
540 = 168 * 3 + 36
168 = 36 * 4 + 24 24 = 168 – 36 * 4
36 = 24 * 1 + 12 12 = 36 – 24 * 1
24 = 12 * 2 + 0
Greatest Common Divisors
Calculating backwards
12 = 36 – 1 * 24
= 36 – 1 * (168 – 4 * 36)
= 36 – 1 * 168 + 4 * 36
= 5 * 36 – 1 * 168
= 5 * (540 – 3 * 168) – 1 * 168
= 5 * 540 – 15 * 168 – 1 * 168
= 5 * 540 – 16 * 168
Greatest Common Divisors
Exercise
GCD of 864 and 291 as an integer linear form in 864 and 291.
x , y: integers
Answer:
x = 32, y = -95
27
Greatest Common Divisors
• Simple properties
Say, d=gcd(a,b)
Let a=p.d and b=q.d
Observe that p and q are relatively prime
Therefore, gcd(p, q)=1
Greatest Common Divisors
………………………………………….
For any integer a, we have gcd(a, a+1)=1
It follows from the fact that any common
divisor of a and a +1 must divide their
difference, that is (a+1)-a=1
Greatest Common Divisors
Where ax + by = 1
Then d=gcd(a,b)