Slide 1

Slide 1 text

cs2102: Discrete Mathematics Class 20: Number Theory David Evans, Mohammad Mahmoody University of Virginia

Slide 2

Slide 2 text

Plan + Reminders Today: number theory Deadline: PS8 this Friday 6:29pm. Tuesday: Review before the exam Next Thursday: 2nd Exam.

Slide 3

Slide 3 text

Clarification

Slide 4

Slide 4 text

Number Theory • A study of integer numbers ℤ = … , −2, −1, 0, 1, 2, … and their properties. All numbers in today’s class integers unless said otherwise.. • Main operations: 1. Addition 2. Multiplication 3. Division..?..

Slide 5

Slide 5 text

Divisibility • If there is such that = then:

Slide 6

Slide 6 text

More Examples • ∣ , ∣ → ? • ∣ , ∣ →? ∣ + for all , ?

Slide 7

Slide 7 text

Primes • > 1 is prime, if its (positive) divisors are 1, • Other > 1 are called composite.

Slide 8

Slide 8 text

Fundamental Theorem of Arithmetic • Every positive > 1 can be uniquely written as: = 1 ⋅ 2 ⋅ … where 1. ′ are all prime 2. ≤ +1 • or equivalently: = 1 1 ⋅ 2 2 ⋅ … where 1. ′ are all prime 2. < +1 3. ’s are all positive integers

Slide 9

Slide 9 text

Which one of these is true? 1. Every even number > 2 is sum of + for primes , . 2. There are infinitely many primes where + 2 is also prime. 3. For > 2 there are no integers , , where + =

Slide 10

Slide 10 text

1. Every even number > 2 is sum of + for primes , . Goldbach conjecture. Verified up to ~1019 2. There are infinitely many primes where + 2 is also prime. Twin primes conjecture. Proved: infinite pairs , + 2 ,both *products* of two primes 3. For > 2 there are no integers , , where + = Fermat’s last theorem..

Slide 11

Slide 11 text

Fermat’s last theorem Pierre de Fermat 1607-1665 French Lawyer (and mathematician) Conjectured by Fermat in 1637 in the margin of Arithmetica where he says the proof is too large to fit in the margin

Slide 12

Slide 12 text

Fermat’s last theorem Conjectured by Fermat in 1637 in the margin of Arithmetica where he says the proof is too large to fit in the margin Proved by Andrew Wiles (then Princeton, now Oxford) in 1994 He was 41 when proved this, so could not get Fields medal for that..

Slide 13

Slide 13 text

Euclid’s algorithm

Slide 14

Slide 14 text

Greatest Common Divisor • For , > 1, = gcd(, ) if > 1 is the greatest common divisor ∣ , ∣ • Example: what is gcd(, ) if ∣ ? • Example: What is gcd(, ) if = and = for primes , ,

Slide 15

Slide 15 text

How to find gcd , in general?

Slide 16

Slide 16 text

Division Theorem • For all , there are , where = ⋅ + and 0 ≤ < || • = (, ) could be positive or negative • = (, ) is always non-negative • Example:

Slide 17

Slide 17 text

Useful Lemma • gcd , = gcd(, , ) • Why true? • Why useful?

Slide 18

Slide 18 text

Euclid’s gcd algorithm Assuming > > 0 • Def Euclid_gcd (m, n) while > 0 = , = = return

Slide 19

Slide 19 text

What is the underlying State-Machine? • Def Euclid_gcd (m, n) while > 0 = , = = return

Slide 20

Slide 20 text

What is a good preserved invariant? • Def Euclid_gcd (m, n) while > 0 = , = = return

Slide 21

Slide 21 text

Why does it terminate? • Def Euclid_gcd (m, n) while > 0 = , = = return

Slide 22

Slide 22 text

Charge • PS8 Due Friday (6:29pm) • Next week: – Tuesday: Review for Exam – Thursday: 2nd Exam