Integers and Division

Similar documents
Sets. We discuss an informal (naive) set theory as needed in Computer Science. It was introduced by G. Cantor in the second half of the nineteenth

CS March 17, 2009

The set of integers will be denoted by Z = {, -3, -2, -1, 0, 1, 2, 3, 4, }

3 The fundamentals: Algorithms, the integers, and matrices

4 Number Theory and Cryptography

ECE 646 Lecture 5. Mathematical Background: Modular Arithmetic

Public Key Cryptography

Number Theory. Modular Arithmetic

MATH 433 Applied Algebra Lecture 4: Modular arithmetic (continued). Linear congruences.

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

Number Theory: Applications. Number Theory Applications. Hash Functions II. Hash Functions III. Pseudorandom Numbers

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

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

NOTES ON SIMPLE NUMBER THEORY

Introduction to Number Theory

Discrete Mathematics GCD, LCM, RSA Algorithm

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

CISC-102 Fall 2017 Week 6

Proofs. Methods of Proof Divisibility Floor and Ceiling Contradiction & Contrapositive Euclidean Algorithm. Reading (Epp s textbook)

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

Introduction to Sets and Logic (MATH 1190)

NUMBER THEORY AND CODES. Álvaro Pelayo WUSTL

Lecture 5: Arithmetic Modulo m, Primes and Greatest Common Divisors Lecturer: Lale Özkahya

a the relation arb is defined if and only if = 2 k, k

CHAPTER 3. Congruences. Congruence: definitions and properties

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

Notes. Number Theory: Applications. Notes. Number Theory: Applications. Notes. Hash Functions I

CSE 20 DISCRETE MATH. Winter

Applied Cryptography and Computer Security CSE 664 Spring 2017

Congruence of Integers

COT 3100 Applications of Discrete Structures Dr. Michael P. Frank

cse 311: foundations of computing Fall 2015 Lecture 12: Primes, GCD, applications

cse 311: foundations of computing Spring 2015 Lecture 12: Primes, GCD, applications

Discrete mathematics I - Number theory

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?

4 Powers of an Element; Cyclic Groups

MATH 145 Algebra, Solutions to Assignment 4

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

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

ICS141: Discrete Mathematics for Computer Science I

Solution Sheet (i) q = 5, r = 15 (ii) q = 58, r = 15 (iii) q = 3, r = 7 (iv) q = 6, r = (i) gcd (97, 157) = 1 = ,

Introduction to Number Theory. The study of the integers

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

ECE 646 Lecture 5. Motivation: Mathematical Background: Modular Arithmetic. Public-key ciphers. RSA keys. RSA as a trap-door one-way function

Number Theory and Group Theoryfor Public-Key Cryptography

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

Section Summary. Division Division Algorithm Modular Arithmetic

Homework #2 solutions Due: June 15, 2012

Number Theory and Cryptography

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

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

ASSIGNMENT Use mathematical induction to show that the sum of the cubes of three consecutive non-negative integers is divisible by 9.

Writing Assignment 2 Student Sample Questions

Number Theory Proof Portfolio

Clock Arithmetic and Euclid s Algorithm

CSC 5930/9010 Modern Cryptography: Number Theory

CSE 20 DISCRETE MATH. Fall

Math 109 HW 9 Solutions

[Part 2] Asymmetric-Key Encipherment. Chapter 9. Mathematics of Cryptography. Objectives. Contents. Objectives

Basic elements of number theory

Basic elements of number theory

NET 311D INFORMATION SECURITY

Chapter 5. Number Theory. 5.1 Base b representations

3.2 Solving linear congruences. v3

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?

Ma/CS 6a Class 2: Congruences

CS483 Design and Analysis of Algorithms

4.5 Applications of Congruences

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

M381 Number Theory 2004 Page 1

Ch 4.2 Divisibility Properties

Chapter 8 Public-key Cryptography and Digital Signatures

Number Theory Math 420 Silverman Exam #1 February 27, 2018

An Introduction to Cryptography

For your quiz in recitation this week, refer to these exercise generators:

4. Number Theory (Part 2)

CPSC 467b: Cryptography and Computer Security

Math From Scratch Lesson 20: The Chinese Remainder Theorem

Chapter 3 Basic Number Theory

An Algorithm for Prime Factorization

Elementary Number Theory Review. Franz Luef

MATHEMATICS EXTENDED ESSAY

Review. CS311H: Discrete Mathematics. Number Theory. Computing GCDs. Insight Behind Euclid s Algorithm. Using this Theorem. Euclidian Algorithm

Proof 1: Using only ch. 6 results. Since gcd(a, b) = 1, we have

2 Elementary number theory

Cryptography. pieces from work by Gordon Royle

Iterated Encryption and Wiener s attack on RSA

With Question/Answer Animations. Chapter 4

Chapter 5: The Integers

CIS 6930/4930 Computer and Network Security. Topic 5.1 Basic Number Theory -- Foundation of Public Key Cryptography

5: The Integers (An introduction to Number Theory)

MATH 4400 SOLUTIONS TO SOME EXERCISES. 1. Chapter 1

4 PRIMITIVE ROOTS Order and Primitive Roots The Index Existence of primitive roots for prime modulus...

Chapter 2. Divisibility. 2.1 Common Divisors

COMP Intro to Logic for Computer Scientists. Lecture 15

Topics in Cryptography. Lecture 5: Basic Number Theory

Number Theory Solutions Packet

Number theory (Chapter 4)

CRYPTOGRAPHY AND NUMBER THEORY

2.3 In modular arithmetic, all arithmetic operations are performed modulo some integer.

Transcription:

Integers and Division Notations Z: set of integers N : set of natural numbers R: set of real numbers Z + : set of positive integers Some elements of number theory are needed in: Data structures, Random number generation, Encryption of data for secure data transmission, Scheduling, etc.

Definition: For integers a and b with a 0 we define a divides b iff an integer c such that b = ac a divides b is written as a b 3 15 3 16 4 16 16 4 a 0 and a b is equivalent to each of: a is a factor of b b is a multiple of a

Theorem: Let a, b, and c be integers. Then (1) if a b and a c then a (b + c). (2) if a b then a bc for all integers c. (3) if a b and b c then a c.

Prime and composite numbers A prime is a positive integer p that has only two distinct positive factors, 1 and p. Examples: 2, 3, 5, 7, 11, 13, 29, 53, 997, 7951,... A positive integer greater that 1 which is not a prime is called composite. Examples: 6 = 2 3, 35 = 5 7, 57 = 3 19, etc.

Fundamental Theorem of Arithmetic Every positive integer n 2 can be written uniquely as a product of primes. Proof (by strong induction). Basis. primes. n = 2 can be written as a trivial product of Induction hypothesis. Assume that any integer 2 k < n can we written as a product of primes. Induction step. If n is prime we are done. If n is not a prime it is composite, i.e., n = n 1 n 2, where 2 n 1, n 2 < n. By induction hypothesis n 1 and n 2 can be factored into product of primes so can be n.

Large primes are used in cryptology. 40 = 2 2 2 5 = 2 3 5 42 = 2 3 7 780 = 2 2 3 5 13 = 2 2 3 5 13 550 = 2 5 5 11 = 2 5 2 11

Theorem If n is a composite number then n has a prime factor n. Proof. If n is composite then n has a factor a, 1 < a < n, hence n = ab, a, b > 1. So a n or b n (otherwise ab > n). Assume without loss of generality that a n. Then either a is prime or it has a prime factor less than a n. This is an important bound when trying to find a factorization of a number. Example 1: n = 311 311. = 17.6 Test division by 2, 3, 5, 7, 11, 13, 17. If none of these divides 311, it is a prime, otherwise we have found a factor. 311 is a prime number.

Example 2: n = 253 253. = 15.9 Test division by 2, 3, 5, 7, 11, 13. 253 = 11*23 so 253 is composite. Factorization of very large numbers by computers is a difficult problem. This fact is used by some encryption systems. RSA encryption system, named after the inventors Rivest, Shamir, and Adelman. Breaking a code would require factoring numbers with 250 to 500 digits that have only two prime factors, both large primes.

The Division Algorithm Let a be an integer and d a positive integer. there exist unique integers q and r, 0 r < d, such that Then a = dq + r a is called the dividend d is called the divisor r is called the remainder q is called the quotient.

GCD and LCM Definition: GCD(a, b), called the greatest common divisor of a and b, is the largest factor of a and b. GCD(18, 24) = 6 GCD(18, 13) = 1 When GCD(a, b) = 1, we say that a and b are relatively prime (or coprime) Definition: LCM(a, b) is the least common multiple of a and b. It is the smallest integer having a and b as factors. LCM(8, 6) = 24 LCM(8, 12) = 24 LCM(11, 17) = 11 17 = 187

GCD and LCM The prime factorization of a and b can be used to find GCD(a, b) or LCM(a, b): 780 = 2 2 3 5 13 = 2 2 3 5 13 550 = 2 5 5 11 = 2 5 2 11 GCD(780, 550) = 2 5 = 10 take the factors common to both numbers with the lowest exponent. LCM(780, 550) = 2 2 3 5 2 11 13 = 42900 take all factors in both numbers with the highest exponent.

If a = p a 1 1 pa 2 2 pa n n b = p b 1 1 p b 2 2 p b n n and gcd(a, b) = p min(a 1,b 1 ) 1 p min(a 2,b 2 ) 2 p min(a n,b n ) n lcm(a, b) = p max(a 1,b 1 ) 1 p max(a 2,b 2 ) 2 p max(a n,b n ) n Note that min(a i, b i ) + max(a i, b i ) = a i + b i, leading to Theorem Let a and b be positive integers. Then ab = gcd(a, b) lcm(a, b) Example: GCD(780, 550) = 2 5 = 10 780 550 = 429000 LCM(780, 550) = 42900

Co-prime integers Definition: The integers a and b are said to be coprime or relatively prime if gcd(a, b) = 1. Example 1: 6 and 25 are co-prime, as gcd(6, 25) = 1. Example 2: 6 and 27 are not co-prime, since gcd(6, 27) = 3 1. Example 3: Any two distinct prime numbers are relatively prime.

Modular Arithmetic Let a be an integer and m be a positive integer. a mod m is defined as the remainder when a is divided by m. 0 (a mod m) < m 8 mod 7 = 1 12 mod 7 = 5 30 mod 7 = 2 51 mod 7 = 2 21 mod 7 = 0 Since the result of the mod operation must be 0 and < 7, 3 mod 7 = 4 since 3 = 1 7 + 4 22 mod 6 = 2 since 22 = 4 6 + 2

Example of the use of mod: A scheduling problem: We have processors 1, 2, 3, 4, 5 and jobs 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,... Scheduling: Given a job number, select a processor on which to execute the job. round-robin scheduling: jobs 1, 6, 11, 16, 21,... are done on processor 2 jobs 2, 7, 12, 17, 22,... are done on processor 3 jobs 3, 8, 13, 18, 23,... are done on processor 4 jobs 4, 9, 14, 19, 24,... are done on processor 5 jobs 5, 10, 15, 20, 25,... are done on processor 1 job i is assigned to processor (i mod 5) + 1

Congruences Definition: Let a and b be integers and m be a positive integer. We say that a is congruent to b modulo m if m (a b). a b (mod m) Examples: 5 (14 9) 14 9 (mod 5) 5 (19 9) 19 9 (mod 5) 5 (32 12) 32 12 (mod 5) 7 (14 7) 14 7 (mod 7) Theorem Let a and b be integers and m be a positive integer. a b (mod m) (a mod m) = (b mod m)

Theorem Let a and b be integers and m be a positive integer. a b (mod m) iff a = b + km for some integer k Problem: Find all integers congruent to 7 modulo 6. It is the infinite set {a : a = 7 + 6k, k Z}. 7 13 (mod 6) 7 19 (mod 6) 7 25 (mod 6) 7 31 (mod 6) 7 37 (mod 6) 7 1 (mod 6) 7 5 (mod 6) 7 11 (mod 6) Theorem. Let m be a positive integer. c d (mod m) then If a b (mod m) and a + c b + d (mod m) a c b d (mod m)

Applications Hashing Functions Assign memory locations to files/records so that they can be retrieved quickly. Records like student records are identified by a key, which uniquely identifies each record. Hashing function h assigns memory location h(k) to the record that has k as its key. One of the hashing functions often used is: h(k) = k (mod m) where m is the number of available memory locations.

Hashing function should be onto so that all memory locations are possible, but it is not one-to-one (there are more possible keys than memory locations.) When this happens more than one file may be assigned to a memory location, we say that a collision occurs. Pseudorandom numbers: Choose 4 integers: m - the modulus, a - the multiplier, c - the increment, x 0 - the seed. 2 a < m and 0 c, x 0 < m x n+1 (ax n + c) mod m n = 0, 1, 2,...

Cryptology: Primitive encryption is to shift each letter in the English alphabet by m positions forward (or backward). Example: In the English alphabet, each letter from a to z is assigned an integer from 0 to 25 respectively. A letter in position p is encrypted by: f(p) = (p + m) mod 26 To recover the message, do f 1 : f 1 (p) = (p m) mod 26 Obviously this method does not provide a high level of security.