number theory: factors and primes

17
01/29/13 Number Theory: Factors and Primes Discrete Structures (CS 173) Derek Hoiem, University of Illinois http://www.brooksdesign- ps.net/Reginald_Brooks/ Code/Html/pin2.htm 1

Upload: others

Post on 24-Feb-2022

3 views

Category:

Documents


0 download

TRANSCRIPT

01/29/13

Number Theory: Factors and Primes

Discrete Structures (CS 173)

Derek Hoiem, University of Illinois

http://www.brooksdesign-

ps.net/Reginald_Brooks/

Code/Html/pin2.htm

1

Goals of this lecture

β€’ Understand basic concepts of number theory including divisibility, primes, and factors

β€’ Be able to compute greatest common divisors and least common multiples

2

Number theory: the study of integers (primes, divisibility, factors, congruence, etc.)

3

Leonard Dickson

(1874-1954)

Thank God that number theory is unsullied by any

application

Virtually every theorem in elementary number theory arises in a natural, motivated way in connection with the problem of making computers do high-speed numerical calculations

Donald Knuth

(quote from 1974)

Other applications include cryptography (e.g., RSA encryption)

http://en.wikipedia.org/wiki/RSA_(algorithm)

Divisibility

4

Suppose π‘Ž and 𝑏 are integers.

Then π‘Ž divides 𝑏 iff 𝑏 = π‘Žπ‘› for some integer 𝑛.

β€œπ‘Ž divides 𝑏” ≑ β€œπ‘Ž | 𝑏”

π‘Ž is a factor or

divisor of 𝑏

𝑏 is a multiple of a

Tip: think β€œa divides into b”

Example: 5 | 55 because 55 = 5 βˆ— 11

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 | 6 5

(π‘Ž | 𝑏) ↔ (𝑏 = π‘Žπ‘›), where 𝑛 is some integer

Proof with divisibility

Claim: For any integers π‘Ž, 𝑏, 𝑐, if π‘Ž|𝑏 and b|𝑐, then π‘Ž|𝑐.

Definition: integer π‘Ž divides integer 𝑏 iff 𝑏 = π‘Žπ‘› for some integer 𝑛

overhead 6

Proof with divisibility

Claim: For any integers π‘Ž, π‘₯, 𝑦, 𝑏, 𝑐, if π‘Ž|π‘₯ and π‘Ž|𝑦, then π‘Ž|𝑏π‘₯ + 𝑐𝑦.

Definition: integer π‘Ž divides integer 𝑏 iff 𝑏 = π‘Žπ‘› for some integer 𝑛

overhead 7

Prime numbers

β€’ Definition: an integer π‘ž β‰₯ 2 is prime if the only positive factors of π‘ž are 1 and π‘ž.

β€’ Definition: an integer π‘ž β‰₯ 2 is composite if it is not prime.

β€’ Fundamental Theorem of Arithmetic: Every integer β‰₯ 2 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.

8

600=2*3*4*5*5

More factor definitions

β€’ Greatest common divisor (GCD): gcd (π‘Ž, 𝑏) is the largest number that divides both π‘Ž and 𝑏 – Product of shared factors of π‘Ž and 𝑏

β€’ Least common multiplier (LCM): lcm π‘Ž, 𝑏 is the smallest number that both π‘Ž and 𝑏 divide

β€’ Relatively prime: π‘Ž and 𝑏 are relatively prime if they share no common factors, so that gcd π‘Ž, 𝑏 = 1

9

Factor examples

gcd(5, 15) =

gcd(0, k) =

gcd(8, 12) =

gcd(8*m, 12*m) =

gcd(k^3, m*k^2) =

10

lcm(120, 15) =

lcm (6, 8) =

lcm(0, k) =

Which of these are relatively prime?

6 and 8?

5 and 21?

6 and 33?

3 and 33?

Any two prime numbers?

11

E.g., if π‘Ž = 31 and 𝑏 = 5, π‘ž = 6 and π‘Ÿ = 1

Euclidean algorithm for computing gcd

12

x y π‘Ÿ=remainder π‘₯, 𝑦

remainder π‘Ž, 𝑏 is the remainder when π‘Ž is divided by 𝑏

gcd (969,102)

Euclidean algorithm for computing gcd

13

x y π‘Ÿ=remainder π‘₯, 𝑦

remainder π‘Ž, 𝑏 is the remainder when π‘Ž is divided by 𝑏

gcd (3289,1111)

Recursive Euclidean Algorithm

14

But why does Euclidean algorithm work?

15

Euclidean algorithm works iff gcd π‘Ž, 𝑏 = gcd 𝑏, π‘Ÿ ,

where π‘Ÿ = remainder(π‘Ž, 𝑏)

Proof of Euclidean algorithm

16

Claim: For any integers π‘Ž, 𝑏, π‘ž, π‘Ÿ, with 𝑏 > 0, if π‘Ž = π‘π‘ž + π‘Ÿ then gcd π‘Ž, 𝑏 =gcd (𝑏, π‘Ÿ).

overhead

Next class

β€’ More number theory: congruence and sets

17