Top Banner
01/29/13 Number Theory: Factors and Primes Discrete Structures (CS 173) Madhusudan Parthasarathy, University of Illinois Boats of Saintes -Maries Van Gogh 1
20

01/29/13 Number Theory: Factors and Primes Discrete Structures (CS 173) Madhusudan Parthasarathy, University of Illinois Boats of Saintes-Maries Van Gogh.

Jan 21, 2016

Download

Documents

Simon Copeland
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 2: 01/29/13 Number Theory: Factors and Primes Discrete Structures (CS 173) Madhusudan Parthasarathy, University of Illinois Boats of Saintes-Maries Van Gogh.

Counting, numbers, 1-1 correspondence

2

Page 3: 01/29/13 Number Theory: Factors and Primes Discrete Structures (CS 173) Madhusudan Parthasarathy, University of Illinois Boats of Saintes-Maries Van Gogh.

Representation of numbers• Unary

• Roman

• Positional number systems: Decimal, binary

3

Page 4: 01/29/13 Number Theory: Factors and Primes Discrete Structures (CS 173) Madhusudan Parthasarathy, University of Illinois Boats of Saintes-Maries Van Gogh.

• al-Khwārizmī : Persian mathematician, astronomer

• “On the calculation with Hindu numerals”; 825 AD decimal positional number system

ALGORITHMS

ZERO (500 AD)

Page 5: 01/29/13 Number Theory: Factors and Primes Discrete Structures (CS 173) Madhusudan Parthasarathy, University of Illinois Boats of Saintes-Maries Van Gogh.

Natural numbers and integers

Natural numbers:closed under addition and multiplication

Integers: closed under addition, subtraction, multiplication (but not “division”)

5

Page 6: 01/29/13 Number Theory: Factors and Primes Discrete Structures (CS 173) Madhusudan Parthasarathy, University of Illinois Boats of Saintes-Maries Van Gogh.

Divisibility

6

Suppose and are integers. Then divides iff for some integer .

“ divides ” “”

is a factor or divisor of

is a multiple of

Example: because

Page 7: 01/29/13 Number Theory: Factors and Primes Discrete Structures (CS 173) Madhusudan Parthasarathy, University of Illinois Boats of Saintes-Maries Van Gogh.

Examples of divisibility

• Which of these holds?4 | 12 11 | -11

4 | 4 -22 | 11

4 | 6 7 | -15 12 | 4 4 | -16

6 | 0

0 | 67

() (, for some integers

Page 8: 01/29/13 Number Theory: Factors and Primes Discrete Structures (CS 173) Madhusudan Parthasarathy, University of Illinois Boats of Saintes-Maries Van Gogh.

Proof with divisibilityClaim: For any integers , if and b, then .Definition: integer divides integer iff for some integer

8

Page 9: 01/29/13 Number Theory: Factors and Primes Discrete Structures (CS 173) Madhusudan Parthasarathy, University of Illinois Boats of Saintes-Maries Van Gogh.

Proof with divisibilityClaim: For any integers , if and , then .Definition: integer divides integer iff for some integer

9

Page 10: 01/29/13 Number Theory: Factors and Primes Discrete Structures (CS 173) Madhusudan Parthasarathy, University of Illinois Boats of Saintes-Maries Van Gogh.

Prime numbers• Definition: an integer is prime if the only positive factors of

are and .

• Definition: an integer is composite if it is not prime.

• Primality is in P! [AKS02]• Fundamental Theorem of Arithmetic (aka unique factorization theorem)

Every integer can be written as the product of one or more prime factors. Except for the order in which you write the factors, this prime factorization is unique. 10

600=2*3*4*5*5

Page 11: 01/29/13 Number Theory: Factors and Primes Discrete Structures (CS 173) Madhusudan Parthasarathy, University of Illinois Boats of Saintes-Maries Van Gogh.

GCD• Greatest common divisor (GCD) for natural numbers a and b: is

the largest number that divides both and max { n | n N, n | a and n | b}.

Defined only if { n | n N, n | a and n | b} has a maximum. So defined iff at least one of a and b is non-zero.

– Product of shared factors of and

• Relatively prime: and are relatively prime if they share no common factors, so that

11

Page 12: 01/29/13 Number Theory: Factors and Primes Discrete Structures (CS 173) Madhusudan Parthasarathy, University of Illinois Boats of Saintes-Maries Van Gogh.

LCM

• Least common multiplier (LCM): is the smallest number that both and divide

lcm(a,b) = min{ p | p N, p >0, a|p and b|p }.

• lcm(0,b)=lcm(a,0)=0 by definition.

12

Page 13: 01/29/13 Number Theory: Factors and Primes Discrete Structures (CS 173) Madhusudan Parthasarathy, University of Illinois Boats of Saintes-Maries Van Gogh.

Factor examples

gcd(5, 15) =

gcd(0, k) =

gcd(8, 12) =

gcd(8*m, 12*m) =

13

lcm(120, 15) =

lcm (6, 8) =

Which of these are relatively prime?6 and 8?5 and 21?6 and 33?3 and 33?Any two prime numbers?

Page 14: 01/29/13 Number Theory: Factors and Primes Discrete Structures (CS 173) Madhusudan Parthasarathy, University of Illinois Boats of Saintes-Maries Van Gogh.

Computing the gcd

14

E.g., if and , and

Naïve algorithm: factor a and b and compute gcd… but no one knows how to factor fast!

Page 15: 01/29/13 Number Theory: Factors and Primes Discrete Structures (CS 173) Madhusudan Parthasarathy, University of Illinois Boats of Saintes-Maries Van Gogh.

Euclidean algorithm for computing gcd

15

x y 𝑟 =remainder (𝑥 , 𝑦 )

is the remainder when is divided by

gcd (969,102)

Page 16: 01/29/13 Number Theory: Factors and Primes Discrete Structures (CS 173) Madhusudan Parthasarathy, University of Illinois Boats of Saintes-Maries Van Gogh.

Euclidean algorithm for computing gcd

16

x y 𝑟 =remainder (𝑥 , 𝑦 )

is the remainder when is divided by

gcd (3289,1111)

Page 17: 01/29/13 Number Theory: Factors and Primes Discrete Structures (CS 173) Madhusudan Parthasarathy, University of Illinois Boats of Saintes-Maries Van Gogh.

Recursive Euclidean Algorithm

17

Page 18: 01/29/13 Number Theory: Factors and Primes Discrete Structures (CS 173) Madhusudan Parthasarathy, University of Illinois Boats of Saintes-Maries Van Gogh.

But why does Euclidean algorithm work?

18

Euclidean algorithm works iff , where

Page 19: 01/29/13 Number Theory: Factors and Primes Discrete Structures (CS 173) Madhusudan Parthasarathy, University of Illinois Boats of Saintes-Maries Van Gogh.

Proof of Euclidean algorithm

19

Claim: For any integers , with , if then .

Page 20: 01/29/13 Number Theory: Factors and Primes Discrete Structures (CS 173) Madhusudan Parthasarathy, University of Illinois Boats of Saintes-Maries Van Gogh.

Next class

• More number theory: congruences• Rationals and reals

20