The Fundamental Theorem of Arithmetic

Similar documents
NOTES ON INTEGERS. 1. Integers

2 Arithmetic. 2.1 Greatest common divisors. This chapter is about properties of the integers Z = {..., 2, 1, 0, 1, 2,...}.

EUCLID S ALGORITHM AND THE FUNDAMENTAL THEOREM OF ARITHMETIC after N. Vasiliev and V. Gutenmacher (Kvant, 1972)

Chapter 1 A Survey of Divisibility 14

1. multiplication is commutative and associative;

Algebra for error control codes

All variables a, b, n, etc are integers unless otherwise stated. Each part of a problem is worth 5 points.

4 Powers of an Element; Cyclic Groups

Course MA2C02, Hilary Term 2013 Section 9: Introduction to Number Theory and Cryptography

An Algorithm for Prime Factorization

Course 2BA1: Trinity 2006 Section 9: Introduction to Number Theory and Cryptography

Algorithmic number theory. Questions/Complaints About Homework? The division algorithm. Division

PRIME NUMBERS YANKI LEKILI

Course 2316 Sample Paper 1

Divisibility. Chapter Divisors and Residues

Chapter 5: The Integers

5: The Integers (An introduction to Number Theory)

NUMBER SYSTEMS. Number theory is the study of the integers. We denote the set of integers by Z:

a = qb + r where 0 r < b. Proof. We first prove this result under the additional assumption that b > 0 is a natural number. Let

1 Overview and revision

2 Elementary number theory

NOTES ON SIMPLE NUMBER THEORY

Chapter 1. From Euclid to Gauss. 1.1 Prime numbers. If a, b Z we say that a divides b (or is a divisor of b) and we write a b, if.

Divisibility. Def: a divides b (denoted a b) if there exists an integer x such that b = ax. If a divides b we say that a is a divisor of b.

. As the binomial coefficients are integers we have that. 2 n(n 1).

Number Theory Basics Z = {..., 2, 1, 0, 1, 2,...} For, b Z, we say that divides b if z = b for some. Notation: b Fact: for all, b, c Z:

The following is an informal description of Euclid s algorithm for finding the greatest common divisor of a pair of numbers:

Foundations of Computer Science Lecture 10 Number Theory

INTEGERS. In this section we aim to show the following: Goal. Every natural number can be written uniquely as a product of primes.

Number Theory Solutions Packet

4 Number Theory and Cryptography

Lecture 4: Number theory

3 The fundamentals: Algorithms, the integers, and matrices

(e) Commutativity: a b = b a. (f) Distributivity of times over plus: a (b + c) = a b + a c and (b + c) a = b a + c a.

Basic elements of number theory

Basic elements of number theory

Definition For a set F, a polynomial over F with variable x is of the form

Greatest Common Divisor MATH Greatest Common Divisor. Benjamin V.C. Collins, James A. Swenson MATH 2730

Divisibility in the Fibonacci Numbers. Stefan Erickson Colorado College January 27, 2006

Math Circle Beginners Group February 28, 2016 Euclid and Prime Numbers Solutions

ALGEBRA. 1. Some elementary number theory 1.1. Primes and divisibility. We denote the collection of integers

Chapter 2. Divisibility. 2.1 Common Divisors

The Chinese Remainder Theorem

Summary: Divisibility and Factorization

The Chinese Remainder Theorem

REAL NUMBERS. Any positive integer a can be divided by another positive integer b in such a way that it leaves a remainder r that is smaller than b.

A Guide to Arithmetic

1. Factorization Divisibility in Z.

An integer p is prime if p > 1 and p has exactly two positive divisors, 1 and p.

PUTNAM TRAINING NUMBER THEORY. Exercises 1. Show that the sum of two consecutive primes is never twice a prime.

MATH 501 Discrete Mathematics. Lecture 6: Number theory. German University Cairo, Department of Media Engineering and Technology.

Math 109 HW 9 Solutions

The next sequence of lectures in on the topic of Arithmetic Algorithms. We shall build up to an understanding of the RSA public-key cryptosystem.

Number Theory Proof Portfolio

A SURVEY OF PRIMALITY TESTS

Practice Number Theory Problems

CHAPTER 6. Prime Numbers. Definition and Fundamental Results

Discrete Mathematics and Probability Theory Fall 2018 Alistair Sinclair and Yun Song Note 6

and LCM (a, b, c) LCM ( a, b) LCM ( b, c) LCM ( a, c)

Finite Fields. Mike Reiter

Integers and Division

8 Primes and Modular Arithmetic

2. THE EUCLIDEAN ALGORITHM More ring essentials

Primes and Modular Arithmetic! CSCI 2824, Fall 2014!!

D i v i s i b i l i t y

Definitions. Notations. Injective, Surjective and Bijective. Divides. Cartesian Product. Relations. Equivalence Relations

Number theory. Myrto Arapinis School of Informatics University of Edinburgh. October 9, /29

Introduction to Public-Key Cryptosystems:

Homework #2 solutions Due: June 15, 2012

+ 1 3 x2 2x x3 + 3x 2 + 0x x x2 2x + 3 4

CS 5319 Advanced Discrete Structure. Lecture 9: Introduction to Number Theory II

Number Theory. CSS322: Security and Cryptography. Sirindhorn International Institute of Technology Thammasat University CSS322. Number Theory.

Discrete Mathematics and Probability Theory Summer 2014 James Cook Note 5

Discrete Mathematics Logics and Proofs. Liangfeng Zhang School of Information Science and Technology ShanghaiTech University

Applied Cryptography and Computer Security CSE 664 Spring 2017

not to be republished NCERT REAL NUMBERS CHAPTER 1 (A) Main Concepts and Results

Chapter 4 Finite Fields

Lecture 7.4: Divisibility and factorization

Math Circle Beginners Group February 28, 2016 Euclid and Prime Numbers

Chapter 5. Modular arithmetic. 5.1 The modular ring

3.2 Solving linear congruences. v3

Notes 6: Polynomials in One Variable

Chapter 5. Number Theory. 5.1 Base b representations

Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry. Spring 2006

Numbers. 2.1 Integers. P(n) = n(n 4 5n 2 + 4) = n(n 2 1)(n 2 4) = (n 2)(n 1)n(n + 1)(n + 2); 120 =

Lecture notes: Algorithms for integers, polynomials (Thorsten Theobald)

Exercises Exercises. 2. Determine whether each of these integers is prime. a) 21. b) 29. c) 71. d) 97. e) 111. f) 143. a) 19. b) 27. c) 93.

MATH 2112/CSCI 2112, Discrete Structures I Winter 2007 Toby Kenney Homework Sheet 5 Hints & Model Solutions

CHAPTER 1 REAL NUMBERS KEY POINTS

Discrete Math in Computer Science Solutions to Practice Problems for Midterm 2

2x 1 7. A linear congruence in modular arithmetic is an equation of the form. Why is the solution a set of integers rather than a unique integer?

Arithmetic Algorithms, Part 1

MATH FINAL EXAM REVIEW HINTS

Fall 2017 Test II review problems

CHAPTER 3. Congruences. Congruence: definitions and properties

Homework 3, solutions

This is a recursive algorithm. The procedure is guaranteed to terminate, since the second argument decreases each time.

7. Prime Numbers Part VI of PJE

Notes on arithmetic. 1. Representation in base B

Rings and modular arithmetic

Transcription:

Chapter 1 The Fundamental Theorem of Arithmetic 1.1 Primes Definition 1.1. We say that p N is prime if it has just two factors in N, 1 and p itself. Number theory might be described as the study of the sequence of primes 2, 3, 5, 7, 11, 13,.... Definition 1.2. 1. The nth prime is denoted by p n. 2. If x R then the number of primes x is denoted by π(x). while Thus p 1 = 2, p 2 = 3, p 3 = 5,..., π( 2) = 0, π(2) = 1, π(π) = 2,.... 1.2 The fundamental theorem Theorem 1.1. Every non-zero natural number n N can be expressed as a product of primes n = p 1 p r ; and this expression is unique up to order. 3

By convention, an empty sum has value 0 and an empty product has value 1. Thus n = 1 is the product of 0 primes. Another way of putting the theorem is that each non-zero n N is uniquely expressible in the form n = 2 e 2 3 e 3 5 e5 where each e p N with e p = 0 for all but a finite number of primes p. The proof of the theorem, which we shall give later in this chapter, is non-trivial. It is easy to lose sight of this, since the theorem is normally met long before the concept of proof is encountered. 1.3 Euclid s Algorithm Definition 1.3. Suppose m, n Z. We say that d N is the greatest common divisor of m and n, and write d = gcd(m, n), if and if e N then d m, d n, e m, e n = e d. The term highest common factor (or hcf), is often used in schools; but we shall always refer to it as the gcd. Note that at this point we do not know that gcd(m, n) exists. This follows easily from the Fundamental Theorem; but we want to use it in proving the theorem so that is not relevant. It is however clear that if gcd(m, n) exists then it is unique. For if d, d N both satisfy the criteria then d d, d d = d = d. Theorem 1.2. Any two integers m, n have a greatest common divisor d = gcd(m, n). Moreover, we can find integers x, y such that d = mx + ny. 4

Proof. We may assume that m > 0; for if m = 0 then it is clear that gcd(m, n) = n, while if m < 0 then we can replace m by m. Now we follow the Euclidean Algorithm. Divide n by m: n = q 0 m + r 0 (0 r 0 < m). If r 0 0, divide m by r 0 : If r 1 0, divide r 0 by r 1 : m = q 1 r 0 + r 1 (0 r 1 < r 0 ). r 0 = q 2 r 1 + r 2 (0 r 2 < r 1 ). Continue in this way. Since the remainders are strictly decreasing: r 0 > r 1 > r 2 >, the sequence must end with remainder 0, say r s+1 = 0. We assert that d = gcd(m, n) = r s, ie the gcd is the last non-zero remainder. For d = r s 1 since r s 1 = q s+1 r s. Now d r s, r s 1 = d r s 2 since r s 2 = r s q s r s 1 ; d r s 1, r s 2 = d r s 3 since r s 3 = r s 1 q s 1 r s 2 ;...... d r 2, r 1 = d m; d r 1, m = d n. Thus d m, n. 5

Conversely, if e m, n then e r 0 since r 0 = n q 0 m; e r 1 since r 1 = m q 1 r 0 ;...... e r s since r s = r s 1 q s r s 1. Thus e m, n = e d. We have proved therefore that gcd(m, n) exists and gcd(m, n) = d = r s. We prove the second part of the theorem, which states that d is a linear combination of m and n (with integer coefficients), we note that if a, b are linear combinations of m, n then a linear combination of a, b is a linear combination of m, n. Now r 1 is a linear combination of m, n, from the first step in the algorithm; r 2 is a linear combination of m, r 1, and so of m, n, from the second step; and so on, until finally d = r s is a linear combination of m, n: d = mx + ny. We say that m, n are coprime if gcd(m, n) = 1. Corollary 1.1. If m, n are coprime then there exist integers x, y such that mx + ny = 1. 1.4 Example Let us determine gcd(1075, 2468). 6

The algorithm goes: 2468 = 2 1075 + 318, 1075 = 3 318 + 121, 318 = 3 121 45, 121 = 3 45 14, 45 = 3 14 + 3, 14 = 5 3 1, 3 = 3 1. Thus the numbers are coprime. To solve gcd(1075, 2468) = 1; 1075x + 2468y = 1, we start at the end: 1 = 5 3 14 = 5(45 3 14) 14 = 5 45 16 14 = 5 45 16(3 45 121) = 16 121 43 45 = 16 121 43(3 121 318) = 43 318 113 121 = 43 318 113(1075 3 318) = 382 318 113 1075 = 382(2468 2 1075) 113 1075 = 382 2468 877 1075. Note that this solution is not unique; we could add any multiple 1075t to x, and subtract 2468t from y, eg 1 = (382 1075) 2468 + (2468 877) 1075 = 1591 2468 693 1075. We shall return to this later. 1.4.1 Speeding up the algorithm Note that if we allow negative remainders then given m, n Z we can find q, r Z such that n = qm + r, where r m /2. 7

If we follow the Euclidean Algorithm allowing negative remainders then the remainder is at least halved at each step. It follows that if 2 r n < 2 r+1 then the algorithm will complete in r steps. Another way to put this is to say that if n is written to base 2 then it contains at most r bits (each bit being 0 or 1). When talking of the efficiency of algorithms we measure the input in terms of the number of bits. In particular, we define the length l(n) to be the number of bits in n. We say that an algorithm completes in polynomial time, or that it is in class P, if the number of steps it takes to complete its task is P (r), where P (x) is a polynomial and r is the number of bits in the input. Evidently the Euclidian algorithm (allowing negative remainders) is a polynomial-time algorithm for computing gcd(m, n). 1.5 An alternative proof There is an apparently simpler way of establishing the result. Proof. We may suppose that x, y are not both 0, since in that case it is evident that gcd(m, n) = 0. Consider the set S of all numbers of the form mx + ny (x, y Z). There are evidently numbers > 0 in this set. integer; say d = ma + nb. We assert that d = gcd(m, n). For suppose d m. Divide m by d: Let d be the smallest such m = qd + r, where 0 < r < d. Then r = m qd = m(1 qa) nqd, Thus r S, contradicting the minimality of d. Hence d m, and similarly d n. 8

On the other hand d m, n = d ma + nb = d. We conclude that d = gcd(m, n). The trouble with this proof is that it gives no idea of how to determine gcd(m, n). It appears to be non-constructive. Actually, that is not technically correct. It is evident from the discussion above that there is a solution to with mx + ny = d x n, y m. So it would be theoretically possible to test all numbers (x, y) in this range, and find which minimises mx + ny. However, if x, y are very large, say 100 digits, this is completely impractical. 1.6 Euclid s Lemma Proposition 1.1. Suppose p is prime; and suppose m, n Z. Then Proof. Suppose p mn = p m or p n. p m. Then p, m are coprime, and so there exist a, b Z such that pa + mb = 1. Now Multiplying by n, pna + mnb = n. p pna, p mnb = p n. 9

1.7 Proof of the Fundamental Theorem Proof. Lemma 1.1. n is a product of primes. Proof: We argue by induction on n If n is composite, ie not prime, then with n = rs, 1 < r, s < n. By our inductive hypothesis, r, s are products of primes. Hence so is n. To complete the proof, we argue again by induction. Suppose n = p 1 p r = q 1 q s are two expressions for n as a product of primes. Then p 1 n = p 1 q 1 q s = p 1 q j for some j. But since q j is prime this implies that q j = p 1. Let us re-number the q s so that q j becomes q 1. Then we have n/p 1 = p 2 p r = q 2 q s. Applying our inductive hypothesis we conclude that r = s, and the primes p 2,..., p r and q 2,..., q s are the same up to order. The result follows. 10