Divisibility and Primes

Slides:



Advertisements
Similar presentations
The Fundamental Theorem of Arithmetic. Primes p > 1 is prime if the only positive factors are 1 and p if p is not prime it is composite The Fundamental.
Advertisements

Presented by Alex Atkins.  An integer p >= 2 is a prime if its only positive integer divisors are 1 and p.  Euclid proved that there are infinitely.
CS 202 Epp section ?? Aaron Bloomfield
Chapter 8 – Introduction to Number Theory. Prime Numbers prime numbers only have divisors of 1 and self –they cannot be written as a product of other.
Section 4.1: Primes, Factorization, and the Euclidean Algorithm Practice HW (not to hand in) From Barr Text p. 160 # 6, 7, 8, 11, 12, 13.
The Integers and Division. Outline Division: Factors, multiples Exercise 2.3 Primes: The Fundamental Theorem of Arithmetic. The Division Algorithm Greatest.
Thinking Mathematically
5.1 Number Theory. The study of numbers and their properties. The numbers we use to count are called the Natural Numbers or Counting Numbers.
Thinking Mathematically
1 Section 2.4 The Integers and Division. 2 Number Theory Branch of mathematics that includes (among other things): –divisibility –greatest common divisor.
4.2 Prime and Composite Numbers Remember to Silence Your Cell Phone and Put It In Your Bag!
CSE 311 Foundations of Computing I Lecture 13 Number Theory Autumn 2012 CSE
Chapter Primes and Greatest Common Divisors ‒Primes ‒Greatest common divisors and least common multiples 1.
February 19, 2015Applied Discrete Mathematics Week 4: Number Theory 1 The Growth of Functions Question: If f(x) is O(x 2 ), is it also O(x 3 )? Yes. x.
Chapter II. THE INTEGERS
6/20/2015 5:05 AMNumerical Algorithms1 x x1x
WHOLE NUMBERS; INTEGERS Whole numbers: Z 0,+ = the natural numbers  {0}. Integers:
CSE 321 Discrete Structures Winter 2008 Lecture 10 Number Theory: Primality.
CSE 311 Foundations of Computing I Lecture 12 Primes, GCD, Modular Inverse Spring
Fall 2002CMSC Discrete Structures1 Let us get into… Number Theory.
BY MISS FARAH ADIBAH ADNAN IMK
Divisibility October 8, Divisibility If a and b are integers and a  0, then the statement that a divides b means that there is an integer c such.
Section 5.1 Number Theory.
Integers Number Theory = Properties of Integers

Chapter 2 The Fundamentals: Algorithms, the Integers, and Matrices
1 Properties of Integers Objectives At the end of this unit, students should be able to: State the division algorithm Apply the division algorithm Find.
Information Security and Management 4. Finite Fields 8
The Integers & Division. a divides b if a is not zero there is a m such that a.m = b “a is a factor of b” “b is a multiple of a” a|b Division.
Numbers MST101. Number Types 1.Counting Numbers (natural numbers) 2.Whole Numbers 3.Fractions – represented by a pair of whole numbers a/b where b ≠ 0.
Copyright © 2009 Pearson Education, Inc. Chapter 5 Section 1 - Slide 1 Chapter 1 Number Theory and the Real Number System.
CSE 311: Foundations of Computing Fall 2014 Lecture 12: Primes, GCD.
Slide Copyright © 2009 Pearson Education, Inc. Unit 1 Number Theory MM-150 SURVEY OF MATHEMATICS – Jody Harris.
Application: Algorithms Lecture 20 Section 3.8 Wed, Feb 21, 2007.
CSE 311: Foundations of Computing Fall 2013 Lecture 12: Primes, GCD, modular inverse.
Factors & Number Theory
Slide Copyright © 2009 Pearson Education, Inc. 5.1 Number Theory.
Chapter 1 Algorithms with Numbers. Bases and Logs How many digits does it take to represent the number N >= 0 in base 2? With k digits the largest number.
1 Discrete Structures – CNS2300 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (5 th Edition) Chapter 2 The Fundamentals: Algorithms,
Ch04-Number Theory and Cryptography 1. Introduction to Number Theory Number theory is about integers and their properties. We will start with the basic.
Number Theory: Prime and Composite Numbers
Number Theory Lecture 1 Text book: Discrete Mathematics and its Applications, 7 th Edition.
Agenda Review:  Relation Properties Lecture Content:  Divisor and Prime Number  Binary, Octal, Hexadecimal Review & Exercise.
A Prime Example CS Lecture 20 A positive integer p  2 is prime if the only positive integers that divide p are 1 and p itself. Positive integers.
Number Theory. Introduction to Number Theory Number theory is about integers and their properties. We will start with the basic principles of divisibility,
Number-Theoretic Algorithms
Section 5.1 Number Theory.
Integers and Division Section 3.4.
Numerical Algorithms x x-1 Numerical Algorithms
Number Theory and the Real Number System
CMSC Discrete Structures
Chapter 5: Number Theory
Thinking Critically 4.1 Divisibility Of Natural Numbers
STUDY GUIDE CORNELL- STYLE.
CSE 311 Foundations of Computing I
MATH301- DISCRETE MATHEMATICS Copyright © Nahid Sultana Dr. Nahid Sultana Chapter 4: Number Theory and Cryptography.
Prime Factorization Prime factorization is the long string of factors that is made up of all prime numbers.
Applied Discrete Mathematics Week 3: Algorithms
Numerical Algorithms x x-1
Applied Discrete Mathematics Week 4: Number Theory
Number Theory (Chapter 7)
Section 5.1 Number Theory.
Number Theory and the Real Number System
Discrete Math for CS CMPSC 360 LECTURE 12 Last time: Stable matching
Section 5.1 Number Theory.
The Integers & Division
Applied Discrete Mathematics Week 10: Introduction to Counting
Number Theory.
Number Theory: Prime & Composite Numbers
From the last time: gcd(a, b) can be characterized in two different ways: It is the least positive value of ax + by where x and y range over integers.
Presentation transcript:

Divisibility and Primes ICS 6D Sandy Irani

Evenly Divides x evenly divides y if y =m·x for some integer m Denoted: x|y y is an integer multiple (or just “multiple”) of x x is a factor of y

Primes and Composites A number p is prime if p is an integer and p > 1 The only (positive) factors of p are 1 and p. If n > 1 is not prime, it is composite n has a positive factor other than 1 or n.

Fundamental Theorem of Arithmetic Every integer n > 1 can be expressed as a product of primes. Prime factorization is unique up to ordering. Prime factorization of n usually written in non-decreasing order: 124 =

Fundamental Theorem of Arithmetic Prime factorization of 360:

Exponential Notation for Prime Factorization Write each distinct prime in the prime factorization in increasing order. The multiplicity of a prime (# of times it appears) is written in the exponent. 124 = 360 =

Prime Factorization and Divisibility If you have the prime factorization for x and y, can easily determine if x divides y: Example: does 90 divide 1260? 1260 = 22 · 32 · 5 · 7 90 = 2 · 32 · 5

Prime Factorization and Divisibility 1260 = 22 · 32 · 5 · 7 40 = 23· 5 22 = 2 · 11

LCM and GCD Two positive integers, x and y. The least common multiple of x and y, lcm(x,y), is the smallest integer that is a multiple of x and a multiple of y. The greatest common divisor of x and y, gcd(x, y) is the largest integer that divides both x and y. x and y are relatively prime if gcd(x, y) = 1

Prime Factorization and LCM If you have the prime factorization for x and y, can easily determine if lcm(x, y): 44 = 22 · 11 90 = 2 · 32 · 5

Prime Factorization and GDC If you have the prime factorization for x and y, can easily determine if gcd(x, y): 1320 = 23 ·3 · 5 · 11 1800 = 22 · 32 · 5

Factoring: Brute-force algorithm Input: integer N > 1 Output: (x,y) such that x > 1, y > 1 and xy = N or “Prime” if N is prime For x = 2 to N-1 If x evenly divides N Return(x, N/x) Return(“Prime”)

Factoring: slightly better algorithm Input: integer N > 1 Output: (x,y) such that x > 1, y > 1 and xy = N or “Prime” if N is prime For x = 2 to N-1 𝑁 If x evenly divides N Return(x, N/x) Return(“Prime”) If N is composite than it as at least one factor that is at most 𝑵

Factoring: slightly better algorithm Input: integer N > 1 Output: (x,y) such that x > 1, y > 1 and xy = N or “Prime” if N is prime For x = 2 to N-1 𝑁 If x evenly divides N Return(x, N/x) Return(“Prime”) If N has 200 digits 𝑵 has 100 digits If inner loop takes .1 ns Algorithm take 3 x 1082 years Time proportional to the value of N, not the number of digits

Factoring and Primality Testing Input: integer N > 1 Output: If N is prime: “Prime” If N is composite: x > 1, y > 1, xy = N Primality Testing Input: integer N > 1 Output: If N is prime: “Prime” If N is composite: “Composite” Hard: no known algorithm that Runs in time (# digits)d Easy: can be solved in time (# digits)2 (probabilistic)

Finding Prime Numbers “Find a 200-digit prime number” How to do this? Repeat: Pick a random 200 digit number N Apply primality test to N If N is prime, return(N) If N is composite, continue. The number of trials until success depends on the density of prime numbers among all 200 digit numbers

Density of primes: a first step Theorem: there are an infinite number of prime numbers. Euclid ~300 B.C.

The Prime Number Theorem Theorem: let π(x) be the number of prime numbers in the range [2,…,x], then lim 𝑥→∞ 𝜋(𝑥) 𝑥/( ln 𝑥) = 1 𝜋(𝑥) 𝑥 ln⁡(𝑥)

The Prime Number Theorem Theorem: let π(x) be the number of prime numbers in the range [2,…,x], then lim 𝑥→∞ 𝜋(𝑥) 𝑥/( ln 𝑥) = 1 Interpretation: A randomly chosen number in the range 2,..,x is prime with probability ~ 1 𝑙𝑛(𝑥) To get a 200 digit prime number, we need the density of primes in the range from 10199 to 10200. ln(x) ~ 2.3·(# digits in x)