Today s Topics. Primes & Greatest Common Divisors



Similar documents
Kevin James. MTHSC 412 Section 2.4 Prime Factors and Greatest Comm

CHAPTER 5. Number Theory. 1. Integers and Division. Discussion

Discrete Mathematics, Chapter 4: Number Theory and Cryptography

CS 103X: Discrete Structures Homework Assignment 3 Solutions

15 Prime and Composite Numbers

Grade 6 Math Circles March 10/11, 2015 Prime Time Solutions

The Prime Numbers. Definition. A prime number is a positive integer with exactly two positive divisors.

Number Theory. Proof. Suppose otherwise. Then there would be a finite number n of primes, which we may

GREATEST COMMON DIVISOR

8 Primes and Modular Arithmetic

6.2 Permutations continued

GCDs and Relatively Prime Numbers! CSCI 2824, Fall 2014!

Homework until Test #2

8 Divisibility and prime numbers

Section 4.2: The Division Algorithm and Greatest Common Divisors

Elementary Number Theory and Methods of Proof. CSE 215, Foundations of Computer Science Stony Brook University

Handout #1: Mathematical Reasoning

The last three chapters introduced three major proof techniques: direct,

MATH 289 PROBLEM SET 4: NUMBER THEORY

Page 331, 38.4 Suppose a is a positive integer and p is a prime. Prove that p a if and only if the prime factorization of a contains p.

RSA and Primality Testing

Handout NUMBER THEORY

Lecture 13 - Basic Number Theory.

Elementary Number Theory

Math 319 Problem Set #3 Solution 21 February 2002

Tests for Divisibility, Theorems for Divisibility, the Prime Factor Test

Primes in Sequences. Lee 1. By: Jae Young Lee. Project for MA 341 (Number Theory) Boston University Summer Term I 2009 Instructor: Kalin Kostadinov

Computer and Network Security

The Fundamental Theorem of Arithmetic

U.C. Berkeley CS276: Cryptography Handout 0.1 Luca Trevisan January, Notes on Algebra

17 Greatest Common Factors and Least Common Multiples

The Euclidean Algorithm

Factoring & Primality

MATH10040 Chapter 2: Prime and relatively prime numbers

ALGEBRAIC APPROACH TO COMPOSITE INTEGER FACTORIZATION

SUM OF TWO SQUARES JAHNAVI BHASKAR

k, then n = p2α 1 1 pα k

DIVISIBILITY AND GREATEST COMMON DIVISORS

I. GROUPS: BASIC DEFINITIONS AND EXAMPLES

Breaking The Code. Ryan Lowe. Ryan Lowe is currently a Ball State senior with a double major in Computer Science and Mathematics and

Not for resale. 4.1 Divisibility of Natural Numbers 4.2 Tests for Divisibility 4.3 Greatest Common Divisors and Least Common Multiples

FACTORS AND MULTIPLES Answer Key

Lecture 3: Finding integer solutions to systems of linear equations

CISC - Curriculum & Instruction Steering Committee. California County Superintendents Educational Services Association

Primality - Factorization

Grade 7/8 Math Circles Fall 2012 Factors and Primes

COMMUTATIVE RINGS. Definition: A domain is a commutative ring R that satisfies the cancellation law for multiplication:

Winter Camp 2011 Polynomials Alexander Remorov. Polynomials. Alexander Remorov

TEXAS A&M UNIVERSITY. Prime Factorization. A History and Discussion. Jason R. Prince. April 4, 2011

Factoring Algorithms

Introduction to Programming (in C++) Loops. Jordi Cortadella, Ricard Gavaldà, Fernando Orejas Dept. of Computer Science, UPC

Example. Introduction to Programming (in C++) Loops. The while statement. Write the numbers 1 N. Assume the following specification:

Continued Fractions and the Euclidean Algorithm

MATH 22. THE FUNDAMENTAL THEOREM of ARITHMETIC. Lecture R: 10/30/2003

MACM 101 Discrete Mathematics I

WOLLONGONG COLLEGE AUSTRALIA. Diploma in Information Technology

MATHEMATICAL INDUCTION. Mathematical Induction. This is a powerful method to prove properties of positive integers.

Theorem3.1.1 Thedivisionalgorithm;theorem2.2.1insection2.2 If m, n Z and n is a positive

Integer Factorization using the Quadratic Sieve

Settling a Question about Pythagorean Triples

Session 6 Number Theory

The Chinese Remainder Theorem

Congruent Number Problem

Chapter 11 Number Theory

5544 = = = Now we have to find a divisor of 693. We can try 3, and 693 = 3 231,and we keep dividing by 3 to get: 1

Overview of Number Theory Basics. Divisibility

A Study on the Necessary Conditions for Odd Perfect Numbers

SUBGROUPS OF CYCLIC GROUPS. 1. Introduction In a group G, we denote the (cyclic) group of powers of some g G by

11 Ideals Revisiting Z

CHAPTER SIX IRREDUCIBILITY AND FACTORIZATION 1. BASIC DIVISIBILITY THEORY

An Introductory Course in Elementary Number Theory. Wissam Raji

Grade 7 & 8 Math Circles October 19, 2011 Prime Numbers

MATH 13150: Freshman Seminar Unit 10

Test1. Due Friday, March 13, 2015.

PROPERTIES OF ELLIPTIC CURVES AND THEIR USE IN FACTORING LARGE NUMBERS

The Division Algorithm for Polynomials Handout Monday March 5, 2012

of Nebraska - Lincoln

Intermediate Math Circles March 7, 2012 Linear Diophantine Equations II

Cryptography and Network Security Chapter 8

Mathematics for Computer Science/Software Engineering. Notes for the course MSM1F3 Dr. R. A. Wilson

z 0 and y even had the form

Discrete Mathematics and Probability Theory Fall 2009 Satish Rao, David Tse Note 2

PROBLEM SET 6: POLYNOMIALS

On Generalized Fermat Numbers 3 2n +1

Math 453: Elementary Number Theory Definitions and Theorems

a 11 x 1 + a 12 x a 1n x n = b 1 a 21 x 1 + a 22 x a 2n x n = b 2.

ABSTRACT ALGEBRA: A STUDY GUIDE FOR BEGINNERS

(0, 0) : order 1; (0, 1) : order 4; (0, 2) : order 2; (0, 3) : order 4; (1, 0) : order 2; (1, 1) : order 4; (1, 2) : order 2; (1, 3) : order 4.

Number Theory Hungarian Style. Cameron Byerley s interpretation of Csaba Szabó s lectures


Chapter 3. if 2 a i then location: = i. Page 40

Quotient Rings and Field Extensions

WRITING PROOFS. Christopher Heil Georgia Institute of Technology

Prime Factorization 0.1. Overcoming Math Anxiety

Every Positive Integer is the Sum of Four Squares! (and other exciting problems)

FACTORING. n = fall in the arithmetic sequence

Lecture Notes on Discrete Mathematics

1. Prove that the empty set is a subset of every set.

9. POLYNOMIALS. Example 1: The expression a(x) = x 3 4x 2 + 7x 11 is a polynomial in x. The coefficients of a(x) are the numbers 1, 4, 7, 11.

PYTHAGOREAN TRIPLES KEITH CONRAD

Transcription:

Today s Topics Primes & Greatest Common Divisors Prime representations Important theorems about primality Greatest Common Divisors Least Common Multiples Euclid s algorithm

Once and for all, what are prime numbers? Definition: A prime number is a positive integer p that is divisible by only 1 and itself. If a number is not prime, it is called a composite number. Mathematically: p is prime x Z + [(x 1 x p) x p] Examples: Are the following numbers prime or composite? 23 Prime 42 Composite, 42 = 2 3 7 17 Prime 3 Prime 9 Composite, 9 = 3 2

Any positive integer can be represented as a unique product of prime numbers! Theorem (The Fundamental Theorem of Arithmetic): Every positive integer greater than 1 can be written uniquely as a prime or the product of two or more primes where the prime factors are written in order of nondecreasing size. Examples: 100 = 2 2 5 5 = 2 2 5 2 641 = 641 999 = 3 3 3 37 = 3 3 37 1024 = 2 2 2 2 2 2 2 2 2 2 = 2 10 Note: Proving the fundamental theorem of arithmetic requires some mathematical tools that we have not yet learned.

This leads to a related theorem Theorem: If n is a composite integer, then n has a prime divisor less than n. Proof: If n is composite, then it has a positive integer factor a with 1 < a < n by definition. This means that n = ab, where b is an integer greater than 1. Assume a > n and b > n. Then ab > n n = n, which is a contradiction. So either a n or b n. Thus, n has a divisor less than n. By the fundamental theorem of arithmetic, this divisor is either prime, or is a product of primes. In either case, n has a prime divisor less than n.

Applying contraposition leads to a naive primality test Corollary: If n is a positive integer that does not have a prime divisor less than n, then n prime. Example: Is 101 prime? The primes less than 101 are 2, 3, 5, and 7 Since 101 is not divisible by 2, 3, 5, or 7, it must be prime Example: Is 1147 prime? The primes less than 1147 are 2, 3, 5, 7, 11, 13, 17, 23, 29, and 31 1147 = 31 37, so 1147 must be composite

This approach can be generalized The Sieve of Eratosthenes is a brute-force algorithm for finding all prime numbers less than some value n Step 1: List the numbers less than n 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 245 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 Step 2: If the next available number is less than n, cross out all of its multiples Step 3: Repeat until the next available number is > n Step 4: All remaining numbers are prime

How many primes are there? Theorem: There are infinitely many prime numbers. Proof: By contradiction Assume that there are only a finite number of primes p 1,, p n Let Q = p 1 p 2 p n + 1 By the fundamental theorem of arithmetic, Q can be written as the product of two or more primes. Note that no p j divides Q, for if p j Q, then p j also divides Q p 1 p 2 p n = 1. Therefore, there must be some prime number not in our list. This prime number is either Q (if Q is prime) or a prime factor of Q (if Q is composite). This is a contradiction since we assumed that all primes were listed. Therefore, there are infinitely many primes. This is a non-constructive existence proof!

Group work! Problem 1: What is the prime factorization of 984? Problem 2: Is 157 prime? Is 97 prime? Problem 3: Is the set of all prime numbers countable or uncountable? If it is countable, show a 1 to 1 correspondence between the prime numbers and the natural numbers.

Greatest common divisors Definition: Let a and b be integers, not both zero. The largest integer d such that d a and d b is called the greatest common divisor of a and b, denoted by gcd(a, b). Note: We can (naively) find GCDs by comparing the common divisors of two numbers. Example: What is the GCD of 24 and 36? Factors of 24: 1, 2, 3, 4, 6, 12 Factors of 36: 1, 2, 3, 4, 6, 9, 12, 18 gcd(24, 36) = 12

Sometimes, the GCD of two numbers is 1 Example: What is gcd(17, 22)? Factors of 17: 1, 17 Factors of 22: 1, 2, 11, 22 gcd(17, 22) = 1 Definition: If gcd(a, b) = 1, we say that a and b are relatively prime, or coprime. We say that a 1, a 2,, a n are pairwise relatively prime if gcd(a i, a j ) = 1 i,j. Example: Are 10, 17, and 21 pairwise coprime? Factors of 10: 1, 2, 5, 10 Factors of 17: 1, 17 Factors of 21: 1, 3, 7, 21

We can leverage the fundamental theorem of arithmetic to develop a better algorithm Let: Then: and Greatest multiple of p 1 in both a and b Greatest multiple of p 2 in both a and b Example: Compute gcd(120, 500) 120 = 2 3 3 5 500 = 2 2 5 3 So gcd(120, 500) = 2 2 3 0 5 = 20

Better still is Euclid s algorithm Observation: If a = bq + r, then gcd(a, b) = gcd(b, r) Proved in section 3.6 page 227 in the book So, let r 0 = a and r 1 = b. Then: r 0 = r 1 q 1 + r 2 0 r 2 < r 1 r 1 = r 2 q 2 + r 3 0 r 3 < r 2 r n-2 = r n-1 q n-1 + r n 0 r n < r n-1 r n-1 = r n q n gcd(a, b) = r n

Examples of Euclid s algorithm Example: Compute gcd(414, 662) 662 = 414 1 + 248 414 = 248 1 + 166 248 = 166 1 + 82 166 = 82 2 + 2 gcd(414, 662) = 2 82 = 2 41 Example: Compute gcd(9888, 6060) 9888 = 6060 1 + 3828 6060 = 3828 1 + 2232 3828 = 2232 1 + 1596 2232 = 1596 1 + 636 1596 = 636 2 + 324 636 = 324 1 + 312 324 = 312 1 + 12 gcd(9888, 6060) = 12 312 = 12 26

Least common multiples Definition: The least common multiple of the integers a and b is the smallest positive integer that is divisible by both a and b. The least common multiple of a and b is denoted lcm(a, b). Example: What is lcm(3,12)? Multiples of 3: 3, 6, 9, 12, 15, Multiples of 12: 12, 24, 36, So lcm(3,12) = 12 Note: lcm(a, b) is guaranteed to exist, since a common multiple exists (i.e., ab).

We can leverage the fundamental theorem of arithmetic to develop a better algorithm Let: Then: and Greatest multiple of p 1 in either a or b Greatest multiple of p 2 in either a or b Example: Compute lcm(120, 500) 120 = 2 3 3 5 500 = 2 2 5 3 So lcm(120, 500) = 2 3 3 5 3 = 3000 << 120 500 = 60,000

LCMs are closely tied to GCDs Note: ab = lcm(a, b) gcd(a, b) Example: a = 120 = 2 3 3 5, b = 500 = 2 2 5 3 120 = 2 3 3 5 900 = 2 2 5 3 lcm(120, 500) = 2 3 3 5 3 = 3000 gcd(120, 500) = 2 2 3 0 5 = 20 lcm(120, 500) gcd(120, 500) = 2 3 3 5 3 2 2 3 0 5 = 2 5 3 5 4 = 60,000 = 120 500

Group work! Problem 1: Use Euclid s algorithm to compute gcd(92928, 123552). Problem 2: Compute gcd(24, 36) and lcm(24, 26). Verify that gcd(24, 36) lcm(24, 36) = 24 36.

Final Thoughts Prime numbers play an important role in number theory There are an infinite number of prime numbers Any number can be represented as a product of prime numbers; this has implications when computing GCDs and LCMs