Divisors. Common divisors. Let m, n P Z with m 0. Wesaythatm divides n if n is a multiple of m, i.e.

Similar documents
The Euclidean Algorithm and Multiplicative Inverses

Chapter 3: The Euclidean Algorithm and Diophantine. Math 138 Burger California State University, Fresno

Intermediate Math Circles February 29, 2012 Linear Diophantine Equations I

Ch 4.2 Divisibility Properties

5.1. Primes, Composites, and Tests for Divisibility

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

2 Elementary number theory

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:

4.4 Solving Congruences using Inverses

Euclidean Domains. Kevin James

Math Circles - Lesson 2 Linear Diophantine Equations cont.

Notes 6: Polynomials in One Variable

Senior Math Circles Cryptography and Number Theory Week 2

EDULABZ INTERNATIONAL NUMBER SYSTEM

4 Powers of an Element; Cyclic Groups

Direct Proof MAT231. Fall Transition to Higher Mathematics. MAT231 (Transition to Higher Math) Direct Proof Fall / 24

Math 0310 Final Exam Review

Multiplying and dividing integers Student Activity Sheet 2; use with Exploring Patterns of multiplying and dividing integers

Math Circles Cryptography

Chapter 3 Basic Number Theory

MATH10040 Chapter 1: Integers and divisibility

Four Basic Sets. Divisors

1) Synthetic Division: The Process. (Ruffini's rule) 2) Remainder Theorem 3) Factor Theorem

4. Number Theory (Part 2)

Warm-Up. Simplify the following terms:

Math101, Sections 2 and 3, Spring 2008 Review Sheet for Exam #2:

Math 110 FOUNDATIONS OF THE REAL NUMBER SYSTEM FOR ELEMENTARY AND MIDDLE SCHOOL TEACHERS

Divisibility of Natural Numbers

Notes on Systems of Linear Congruences

Introduction to Number Theory. The study of the integers

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.

Divisibility, Factors, and Multiples

Computing Quotient and Remainder. Prime Numbers. Factoring by Trial Division. The Fundamental Theorem of Arithmetic

NUMBER THEORY AND CODES. Álvaro Pelayo WUSTL

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

#26: Number Theory, Part I: Divisibility

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

The Euclidean Algorithm

Exam 2 Solutions. In class questions

Chapter 1. Greatest common divisor. 1.1 The division theorem. In the beginning, there are the natural numbers 0, 1, 2, 3, 4,...,

A group of figures, representing a number, is called a numeral. Numbers are divided into the following types.

18 Divisibility. and 0 r < d. Lemma Let n,d Z with d 0. If n = qd+r = q d+r with 0 r,r < d, then q = q and r = r.

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

Remainders. We learned how to multiply and divide in elementary

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

Chapter 14: Divisibility and factorization

Applied Cryptography and Computer Security CSE 664 Spring 2017

WORKSHEET MATH 215, FALL 15, WHYTE. We begin our course with the natural numbers:

COMP239: Mathematics for Computer Science II. Prof. Chadi Assi EV7.635

Finding Divisors, Number of Divisors and Summation of Divisors. Jane Alam Jan

1. Factorization Divisibility in Z.

Number Theory and Divisibility

CPSC 467: Cryptography and Computer Security

Chapter 2 INTEGERS. There will be NO CALCULATORS used for this unit!

DIVISIBILITY AND GREATEST COMMON DIVISORS

WORKSHEET ON NUMBERS, MATH 215 FALL. We start our study of numbers with the integers: N = {1, 2, 3,...}

A number that can be written as, where p and q are integers and q Number.

Algebra Summer Review Packet

3 The fundamentals: Algorithms, the integers, and matrices

Decimal Addition: Remember to line up the decimals before adding. Bring the decimal straight down in your answer.

Chapter 3: Polynomial and Rational Functions

MATH 3030, Abstract Algebra FALL 2012 Toby Kenney Midyear Examination Friday 7th December: 7:00-10:00 PM

Number Theory A focused introduction

We say that a polynomial is in the standard form if it is written in the order of decreasing exponents of x. Operations on polynomials:

CISC-102 Winter 2016 Lecture 11 Greatest Common Divisor

Number Theory. Introduction

REVIEW Chapter 1 The Real Number System

Ch. 12 Higher Degree Equations Rational Root

N= {1,2,3,4,5,6,7,8,9,10,11,...}

Number theory (Chapter 4)

Lecture 7.4: Divisibility and factorization

Unit 4, Ongoing Activity, Little Black Book of Algebra II Properties

Sect Complex Numbers

Chapter 1 A Survey of Divisibility 14

Quantitative Aptitude

THE DIVISION THEOREM IN Z AND R[T ]

Lecture 2. The Euclidean Algorithm and Numbers in Other Bases

NOTES ON SIMPLE NUMBER THEORY

MTH 310, Section 001 Abstract Algebra I and Number Theory. Sample Midterm 1

Math 131 notes. Jason Riedy. 6 October, Linear Diophantine equations : Likely delayed 6

Math.3336: Discrete Mathematics. Primes and Greatest Common Divisors

6.1. Rational Expressions and Functions; Multiplying and Dividing. Copyright 2016, 2012, 2008 Pearson Education, Inc. 1

CSE 215: Foundations of Computer Science Recitation Exercises Set #5 Stony Brook University. Name: ID#: Section #: Score: / 4

PMA225 Practice Exam questions and solutions Victor P. Snaith


2.2 Inverses and GCDs

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

4 Number Theory and Cryptography

SECTION 2.3: LONG AND SYNTHETIC POLYNOMIAL DIVISION

Factorization in Polynomial Rings

THE DIVISION THEOREM IN Z AND F [T ]

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

Chapter 5. Number Theory. 5.1 Base b representations

Basic elements of number theory

Basic elements of number theory

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 =

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.

Polynomial and Synthetic Division

CS March 17, 2009

Modular Arithmetic Instructor: Marizza Bailey Name:

Transcription:

Divisors Let m, n P Z with m 0. Wesaythatm divides n if n is a multiple of m, i.e. n mk for some k P Z, written m n If m does not divide n, thenwewritem - n. Examples: 3 6 since 6 3 2; 15 60 since 60 15 4; 15-25 since there is no m P Z such that 25 15 m. In general, for any n P Z, n n, n n, 1 n, and 1 n. We often restrict to talking about numbers n P Z 0,andlistthe divisors as the positive integers that divide n. Example: the divisors of 12 are 1, 2, 3, 4, 6, and 12. Common divisors For two numbers a, b P Z 0,acommon divisor d is a divisor common to both numbers, i.e. d a and d b. For example, 3 is a divisor of 30, but not 40; 4 is a divisor of 40, but not 30; 1, 2, 5, and10 are all common divisors of 30 and 40. The greatest common divisor of a and b, denoted gcdpa, bq is largest number that divides both a and b. Example: gcdp30, 40q 10. Always, gcdpa, bq gcdpb, aq. If b a, thengcdpa, bq b. If gcdpa, bq 1, we say that a and b are relatively prime. Example: The divisors of 25 are 1, 5, and 25; the divisors of 12 are 1, 2, 3, 4, 6, and 12; so 25 and 12 are relatively prime (even though neither is prime).

Computing the greatest common divisor Method 1: Compute all the divisors of a and b, and compare. VERY ine cient! Method 2: Compute the prime factorizations, and take their intersection. Example: 19500 2 2 3 5 3 13 and 440 2 3 5 11, so gcdp19500, 400q 2 2 5 20. In other words, gcdpa, bq will be the product over primes p to the highest power n such that p n a and p n b. You try: compute the prime factorizations of 12, 30, 35, and 84, and use them to compute gcdp12, 30q, gcdp12, 35q, gcdp12, 84q, gcdp30, 35q, gcdp30, 84q, Not computationally e cient either! (Prime factorization is computationally di cult/not possible without a list of primes.)

Method 3: The Euclidean algorithm. First, we ll need the division algorithm, which says for any a, b P Z, there are unique integers q and r satisfying a bq ` r and 0 r b. Think: a divided by b is q with remainder r. Ex: if a 17,b 5, thenq 3 and r 2 since 17 5 3 ` 2. Ex: if a 17,b 5, thenq 4 and r 3 since 17 5 p 4q`2. 20 15 10 5 0 5 10 15 20 17 17 Proof: (sketch) If a and b are the same sign, subtract b from a until the result is between 0 and b 1. Theresultisr and the number of subtractions is q. Ifthey redi erent signs, add b to a until the result is between 0 and b 1. Theresultisr and the number of additions is q.

We have if a 17,b 5, thenq 3 and r 2 since 17 5 3 ` 2. If a 2 5,b 2 2, thenq 2 2 and r 2 1 since 5 2 2 ` 1. And if a 3 2,b 3 1, thenq 3 2 and r 3 0 since 2 2 1 ` 0. Notice: gcdp17, 5q 1. Play this game again with new a and b: 1. Start with a 1 a and b 1 b. 2. Compute the quotient q i and remainder r i in dividing a i by b i. 3. Repeat the division algorithm using a i b i 1 and b i r i 1. 4. Iterate until you get r n 0. Then compare gcdpa, bq with r n 1. You try: Do this process with a 30, b 12, andthenwith a 84, b 30. Spreadsheet functions For a and integer and b a positive integer, =FLOORpa, bq gives the largest multiple of b less or equal to a. Namely, if a bq ` r, thenfloorpa, bq bq. Example: =FLOORp17, 5q returns 15, =FLOORp 17, 5q returns 20, =FLOORp17, 5q returns an error. So to compute q and r such that a bq ` r, =FLOORpa, bq{b returns q, =a FLOORpa, bq returns r.

Why does r n 1 gcdpa, bq? In general, our process looks like r 1 a r 0 b q1 ` r 1 r 0 b r 1 q 2 ` r 2 r 1 r 2 q 3 ` r 3. r n 4 r n 3 q n 2 ` r n 2 r n 3 r n 2 q n 1 ` r n 1 gcdpa, bq? r n 2 r n 1 q n ` 0 r n To make everything look the same, let r 1 a and r 0 b. So every line comes in the form r i 2 r i 1 q i ` r i. Why does r n 1 gcdpa, bq? Let r 1 a and r 0 b, so that the algorithm looks like r 1 r 0 q 1 ` r 1 r 0 r 1 q 2 ` r 2 r 1 r 2 q 3 ` r 3. r n 4 r n 3 q n 2 ` r n 2 r n 3 r n 2 q n 1 ` r n 1 gcdpa, bq? r n 2 r n 1 q n ` 0 r n Last line: r n 2 r n 1 q n. So r n 3 r n 2 q n 1 ` r n 1 pr n 1 q n qq n 1 ` r n 1 r n 1 pq n q n 1 ` 1q. Then r n 4 r n 3 q n 2 ` r n 2 r n 1 pq n q n 1 ` 1qq n 2 ` r n 1 q n r n 1 pq n q n 1 q n 2 ` q n 2 ` 1q.

Why does r n 1 gcdpa, bq? Example: We saw 84 30 2 ` 24 30 24 1 ` 6 24 6 4 ` 0. r n 1 6 So 30 24 1 ` 6 p6 4q 1`6 6p4 1 ` 1q 6 5 84 30 2 ` 24 p6 5q 2`p6 4q 6p5 2 ` 4q 6 24. So 6 is a common divisor of 84 and 30.

From our spreadsheet, we can calculate that for a 100, b 36: So 100 36 2 ` 28 36 28 1 ` 8 28 8 3 ` 4 8 4 2 ` 0. r n 1 4 28 8 3 ` 4 p4 2q 3 ` 4 4p2 3 ` 1q 4 7 36 28 1 ` 8 p4 7q 1 `p4 2q 4p7 1 ` 2q 4 9 100 36 2 ` 28 p4 9q 2 `p4 7q 4p9 2 ` 7q 4 25. So 4 is a common divisor of 100 and 36. You try: use the following computations, working backwards, to show that 2 is a common divisor of 100 and 26: 100 26 3 ` 22 26 22 1 ` 4 22 4 5 ` 2 4 4 4 ` 0

Why does r n 1 gcdpa, bq? Letting r 1 a and r 0 b, and computing r 1 r 0 q 1 ` r 1 r 0 r 1 q 2 ` r 2 r 1 r 2 q 3 ` r 3. r n 4 r n 3 q n 2 ` r n 2 r n 3 r n 2 q n 1 ` r n 1 gcdpa, bq? r n 2 r n 1 q n ` 0 r n we can reverse this process to show that r n 1 is, at the very least, a common divisor to a r 1 and b r 0. Wait! How do we know we ever get 0?? The division algorithm ensures that each remainder is strictly smaller than the last, and always non-negative: b r 0 r 1 r 2 0. So since the r i s are all integers, this process ends at some point.

Why does r n 1 gcdpa, bq? We have that r n 1 is a common divisor to a an b. Nowwhyisit the greatest common divisor? Suppose d is a common divisor of a and b, i.e.d a and d b. This means a d and b d for some, P Z. Back to our division calculation, and substitute these equations in: a b q 1 ` r 1 b r 1 q 2 ` r 2 r 1 r 2 q 3 ` r 3. r n 3 r n 2 q n 1 ` r n 1 r n 2 r n 1 q n ` 0 Why does r n 1 gcdpa, bq? We have that r n 1 is a common divisor to a an b. Nowwhyisit the greatest common divisor? Suppose d is a common divisor of a and b, i.e.d a and d b. This means a d and b d for some, P Z. Back to our division calculation, and substitute these equations in: d d q 1 ` r 1 so r 1 dp q 1 q dm 1 d dm 1 q 2 ` r 2 so r 2 dp m 1 q 2 q dm 2 dm 1 dm 2 q 3 ` r 3 so r 3 dm 3. dm n 3 dm n 2 q n 1 ` r n 1 so r n 1 dm n 1 r n 2 r n 1 q n ` 0 So d is a divisor of r n 1. In particular, since r n 1 0, wehave d r n 1 and d r n 1. In other words, r n 1 is a common divisor to a and b, and any other common divisor is less than or equal to r n 1. So r n 1 gcdpa, bq.

The Euclidean algorithm for computing the greatest common divisor of two positive numbers a and b is the process or successively dividing until just before you get a 0 divisor (like we just did). Namely, we have the following theorem. Theorem (Euclidean algorithm) To compute the greatest common divisor of two positive integers a and b, letr 1 a and r 0 b, and compute successive quotients and remainders r i 2 r i 1 q i ` r i for i 1, 2, 3,..., until some remainder r n is 0. The last nonzero remainder r n 1 is then the greatest common divisor of a and b. This takes at most b steps (actually less), and is much more computationally e cient than the other methods.