Number Theory: Factors and Primes
Transcript of Number Theory: Factors and Primes
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?
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)
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