SLIDE 4 Proof by Contradiction
2 is irrational.
Proof: Suppose that 2 is rational But that is a contradiction.
13
There are an Infinite Number of Primes
Proof:
Suppose the set of primes is finite. But that’s a contradiction.
14
List all the primes in this finite set: P1, P2…,Pn. Construct the number m=p1•p2•…•Pn + 1. Since m is bigger than any pi, m is not prime remainder of m/pi is 1 (by QRT), so pi doesn’t divide m for any i. But, due to Prime Factorization theorem, m has prime factors (since m > 1). So m has some prime factor not equal to any pi, so the finite set of primes is missing a prime.
gcd, lcm
Greatest Common Divisor (GCD)
GCD(m, n) is the largest integer k that divides integers m and n
– k | m and k | n
GCD(m, n) is a linear combination (with integer coefficients) of m and n
– ∃i, j ∈ Z: gcd(m, n) = im + jn
To calculate GCD(m, n)
– Compute prime factorization of m and n – gcd(m, n) = common prime factors (and powers) of m and n
Euclid’s algorithm
– int gcd(m, n) – if (n == 0) return m
else return gcd(n, m mod n)
Least Common Multiple (LCM)
LCM(m, n) is the smallest integer k such that integers m and n divide k
– m | k and n | k
To calculate LCM(m , n)
– Compute prime factorizations of m and n – lcm(m, n) = union of prime factors (and powers) of m and n
15
Computing GCD
Calculating GCD of 24 120
Prime factorization Euclid’s algorithm
16
134 % 24 = 14 134 = 5•24 + 14 24 % 14 = 10 24 = 1•14 + 10 14 % 10 = 4 14 = 1•10 + 4 10 % 4 = 2 10 = 2•4 + 2 4 % 2 = 0 4 = 2•2 + 0 gcd = 2