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



Similar documents
CS 103X: Discrete Structures Homework Assignment 3 Solutions

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

Today s Topics. Primes & Greatest Common Divisors

8 Primes and Modular Arithmetic

MATH10040 Chapter 2: Prime and relatively prime numbers

Homework until Test #2

15 Prime and Composite Numbers

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

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

8 Divisibility and prime numbers

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

3. Mathematical Induction

SUM OF TWO SQUARES JAHNAVI BHASKAR

MATH 289 PROBLEM SET 4: NUMBER THEORY

GREATEST COMMON DIVISOR

DIVISIBILITY AND GREATEST COMMON DIVISORS

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

I. GROUPS: BASIC DEFINITIONS AND EXAMPLES

6.2 Permutations continued

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

Chapter 11 Number Theory

Continued Fractions and the Euclidean Algorithm

Applications of Fermat s Little Theorem and Congruences

Handout #1: Mathematical Reasoning

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

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

Winter Camp 2011 Polynomials Alexander Remorov. Polynomials. Alexander Remorov

Elementary Number Theory

Mathematical Induction

The Mean Value Theorem

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.

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

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

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

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

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

WRITING PROOFS. Christopher Heil Georgia Institute of Technology

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

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

of Nebraska - Lincoln

On the generation of elliptic curves with 16 rational torsion points by Pythagorean triples

Chapter 4, Arithmetic in F [x] Polynomial arithmetic and the division algorithm.

SECTION 10-2 Mathematical Induction

Full and Complete Binary Trees

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

ALGEBRAIC APPROACH TO COMPOSITE INTEGER FACTORIZATION

Congruent Number Problem

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

CHAPTER 3. Methods of Proofs. 1. Logical Arguments and Formal Proofs

Quotient Rings and Field Extensions

Notes on Factoring. MA 206 Kurt Bryan

Math 319 Problem Set #3 Solution 21 February 2002

Solutions for Practice problems on proofs

Basic Proof Techniques

Lecture 3: Finding integer solutions to systems of linear equations

Some practice problems for midterm 2

RSA and Primality Testing

CONTINUED FRACTIONS AND PELL S EQUATION. Contents 1. Continued Fractions 1 2. Solution to Pell s Equation 9 References 12

Factoring Algorithms

SOLUTIONS FOR PROBLEM SET 2

MATH 537 (Number Theory) FALL 2016 TENTATIVE SYLLABUS

Number Theory: A Mathemythical Approach. Student Resources. Printed Version

Factoring & Primality

Introduction. Appendix D Mathematical Induction D1

The Chinese Remainder Theorem

11 Ideals Revisiting Z

PYTHAGOREAN TRIPLES KEITH CONRAD

Primality - Factorization

Mathematical Induction. Lecture 10-11

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

V Quantitative Reasoning: Computers, Number Theory and Cryptography

Discrete Structures. Lecture Notes

Lecture 13 - Basic Number Theory.

26 Integers: Multiplication, Division, and Order

The Fundamental Theorem of Arithmetic

INCIDENCE-BETWEENNESS GEOMETRY

Solving Linear Systems, Continued and The Inverse of a Matrix

HOMEWORK 5 SOLUTIONS. n!f n (1) lim. ln x n! + xn x. 1 = G n 1 (x). (2) k + 1 n. (n 1)!

Handout NUMBER THEORY

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

A Study on the Necessary Conditions for Odd Perfect Numbers

POLYNOMIAL RINGS AND UNIQUE FACTORIZATION DOMAINS

SYSTEMS OF PYTHAGOREAN TRIPLES. Acknowledgements. I would like to thank Professor Laura Schueller for advising and guiding me

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

Cartesian Products and Relations

CONTINUED FRACTIONS AND FACTORING. Niels Lauritzen

CONTENTS 1. Peter Kahn. Spring 2007

Settling a Question about Pythagorean Triples

Discrete Mathematics, Chapter 4: Number Theory and Cryptography

Category 3 Number Theory Meet #1, October, 2000

Just the Factors, Ma am

Session 6 Number Theory

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

Computing exponents modulo a number: Repeated squaring

Section 4.2: The Division Algorithm and Greatest Common Divisors

Undergraduate Notes in Mathematics. Arkansas Tech University Department of Mathematics

Doug Ravenel. October 15, 2008

PRIME FACTORS OF CONSECUTIVE INTEGERS

WHAT ARE MATHEMATICAL PROOFS AND WHY THEY ARE IMPORTANT?

mod 10 = mod 10 = 49 mod 10 = 9.

Transcription:

The Prime Numbers Before starting our study of primes, we record the following important lemma. Recall that integers a, b are said to be relatively prime if gcd(a, b) = 1. Lemma (Euclid s Lemma). If gcd(a, b) = 1 and a bc then a c. Proof. This is an application of Bezout s Theorem, which tells us that there are integers x, y such that 1 = ax + by. Multiply this equation on both sides by c and you get c = acx + bcy. Since a divides acx (obviously) and a divides bcx (by hypothesis) it follows that a divides their sum, so a divides c. Definition. A prime number is a positive integer with exactly two positive divisors. If p is a prime then its only two divisors are necessarily 1 and p itself, since every number is divisible by 1 and itself. The first ten primes are 2, 3, 5, 7, 11, 13, 17, 19, 23, 29. It should be noted that 1 is NOT PRIME. Lemma. If p is prime then gcd(a, p) = 1 if and only if p does not divide a. The proof is an easy exercise with the definitions. This result says in particular that if p is prime then p is relatively prime to all numbers except the multiples of p. Combining this with Euclid s Lemma we get the following. Corollary. If p is prime and p ab then either p a or p b. Proof. Suppose p is prime and p ab. If p a we are done. If not, then gcd(p, a) = 1 and by Euclid s Lemma we conclude that p b. Definition. Any integer greater than 1 which is not prime is called composite. 1

The first few composite numbers are 4, 6, 8, 9, 10, 12, 14, 15. You may already know the result that every composite integer can be factored into a product of primes. That fact, and the fact that the factorization is unique except for the ordering of the prime factors, is called the Fundamental Theorem of Arithmetic. The main goal of this lecture is to prove the fundamental theorem of arithmetic. Before we do that, we prove a few other results. Lemma. Every integer greater than 1 has at least one prime divisor. Proof. (By contradiction) Assume there is some integer greater than 1 with no prime divisors. Then the set of all such integers is non-empty, and thus (by the well-ordering principle) has a least element; call it n. By construction, n has no prime divisors, and n is a divisor of n, so n is not prime. In other words, n is composite. This means that n has at least three positive divisors, and so has at least one positive divisor, a, other than 1 and n. Thus n = ab for integers a, b such that 1 < a < n, 1 < b < n. Since 1 < a < n we know that a has a prime divisor (since n was the smallest integer greater than 1 with no prime divisors). But this is a contradiction, since that prime divisor of a is also a prime divisor of n. This contradiction proves the lemma. Theorem. There are an infinite number of primes. Proof. (By contradiction) Assume there are only finitely many primes, say they are p 1, p 2,..., p k. Set P = p 1 p 2 p k and put M = P +1. Since M > 1 the lemma says that M has a prime divisor; call it q. Since p 1, p 2,..., p k is a complete list of all the primes, by our assumption, we must have q = p j for some j. But then q divides the product P = p 1 p 2 p k, so q divides M P = 1. Since q > 1 this is a contradiction: no integer greater than 1 can divide 1. This contradiction shows our assumption at the beginning is impossible, which proves the result. Note: The preceding proof is due to Euclid. 2

Theorem. Any composite number n must have a prime divisor not exceeding the square root of n. Proof. Since n is composite, we have n = ab where 1 < a < n, 1 < b < n. If both factors a, b are greater than n then their product n = ab would be greater than n n = n, a contradiction, so one of the factors, say a, must not be greater than n (i.e., a n). By the lemma proved earlier, we know that a has a prime divisor (which is n) so n has the same prime divisor. This last result provides an easy algorithm for proving that a given positive integer p is prime. You just have to check all integers p and if none of them divide p, you have proved that p is prime. This algorithm is easy to implement on a computer. Here s a simple Python program that decides whether or not a given positive number p is prime: def isprime(p): n = 2 while n*n <= p: if p % n == 0: return False else: n = n+1 return True If you like, you can try this code on a computer. (Windows users need to install Python first it is available for free at python.org. Mac users don t need to do anything; all Macs come with Python.) To run the code, you need to type it into a file with the py extension, for example you could name the file isprime.py. Use a good text editor such as TextEdit on Macs or Gedit on Windows. The indentation of the commands is critical, and Python code will not run correctly unless all the indentation is preserved. Once you have the file isprime.py you simply open a terminal (command shell) from that folder and type python to start the Python interpreter, followed by the import statement exactly as shown below in order to import the code into the Python session. 3

$ python >>> from isprime import * >>> isprime(37) True >>> isprime(8901) False Once the interpreter is running, you can test numbers to your heart s content. Type quit() or CTRL-D to quit the Python session. Be advised that if you type in a number that is too large then you may have to wait a long time for an answer! The previous theorem is also used in the Sieve of Eratosthenes, which is a simple algorithm to compute all the primes up to a given bound. We illustrate by computing all the primes up to 100. Start by listing all the numbers starting with 2: 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 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 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 and then cross out the proper multiples of 2 through 10. The remaining numbers are the primes up to 100. There are many easy to state conjectures about primes that remain unsolved to this day. Here are two famous examples. Conjecture (Twin prime conjecture). There are infinitely many pairs of primes of the form p, p + 2. Conjecture (Goldbach s conjecture). Every even integer greater than 2 can be written as a sum of two primes. These problems are considered to be very hard, mainly because little progress has been made on them and they have been around for a long time. Goldbach s conjecture, for example, dates back to the year 1742! Theorem (Fundamental Theorem of Arithmetic). Every positive integer greater than 1 can be written as a product of primes. If we arrange the factors in order then the factorization is unique. 4

There are two parts to the proof: existence and uniqueness. The existence part is an easy induction, and we do it now. If n is prime, then n = n is expressing n as a product of primes (trivially). If n is a composite integer greater than 1, we already showed that n must have a prime divisor, say q. Then n/q, which is smaller than n, can be written as a product of primes by the inductive hypothesis. So n/q = p 1 p 2 p k, and thus n = qp 1 p 2 p k is expressible as a product of primes. This proves the existence statement. It remains to prove the uniqueness part of the theorem. lemma. This requires a Lemma. If p is a prime and p divides a product a 1 a 2 a k of integers, then p must divide at least one of the factors of the product. Proof. This is a consequence of Euclid s Lemma. We prove the result by induction on the number k of factors. If k = 1 the result is trivial. Assume the result holds for all products with k factors, and consider a product a 1 a 2 a k a k+1 = a 1 (a 2 a k a k+1 ) of integers with k + 1 factors which is divisible by p. If p divides a 1 then we are done. Otherwise, gcd(p, a 1 ) = 1 and thus by Euclid s Lemma p must divide the product p 2 p k+1. Since this is a product with k factors the induction hypothesis applies to show there must be a factor divisible by p. Now we use the lemma to prove uniqueness of prime factorization. The proof is by contradiction. Let n be an integer greater than 1. Assume that n can be expressed in two different ways as a product of primes: n = p 1 p 2 p r = q 1 q 2 q s. There may be some factors in common, so cancel them from both sides. After canceling all common factors, we are left with an equation p i1 p i2 p iu = q j1 q j2 q jv with no common factors, and at least one prime appearing somewhere. This is a contradiction, since by the lemma that prime must be a factor of the other side in which it appears, and thus we would still have a common factor. This contradiction shows that prime factorization is unique, and completes the proof of the fundamental theorem of arithmetic. 5

Unique factorization into primes is actually a big deal in number theory. In the 1800s, certain generalizations of the integers called algebraic integers were studied, and great progress on Fermat s Last Theorem was made using those generalizations. Unfortunately, the proof assumed that the property of unique factorization into primes extended to the new algebraic integers, and this turned out to be incorrect! For a simple example, let A be the set of all complex numbers expressible in the form a + b 5, where a, b are integers. Note that every integer is of this form (with b = 0 so this set contains the set of integers. Now 6 = 2 3 = (1 + 5)(1 5) and it can be shown that all the factors 2, 3, 1 + 5, 1 5 are prime in A. Hence, the unique factorization property does not hold in the set A. 6