Agenda Review:  Relation Properties Lecture Content:  Divisor and Prime Number  Binary, Octal, Hexadecimal Review & Exercise.

Slides:



Advertisements
Similar presentations
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.
Advertisements

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.
1 Section 2.4 The Integers and Division. 2 Number Theory Branch of mathematics that includes (among other things): –divisibility –greatest common divisor.
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.
CSE115/ENGR160 Discrete Mathematics 03/13/12 Ming-Hsuan Yang UC Merced 1.
Number Theory and Cryptography
Chapter II. THE INTEGERS
1 Section 2.5 Integers and Algorithms. 2 Euclidean algorithm for finding gcd Where L is a larger number, and S is a smaller number, to find gcd(L,S):
WHOLE NUMBERS; INTEGERS Whole numbers: Z 0,+ = the natural numbers  {0}. Integers:
Fall 2002CMSC Discrete Structures1 Let us get into… Number Theory.
The Integers and Division
Homework Review notes Complete Worksheet #2. Homework State whether the conditional sentence is true or false 1.If 1 = 0, then 1 = – 1 True F F T.
CSCI 1900 Discrete Structures
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.
9/2/2015Discrete Structures1 Let us get into… Number Theory.
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 3 (Part 3): The Fundamentals: Algorithms, the.
February 24, 2015Applied Discrete Mathematics Week 4: Number Theory 1 Modular Arithmetic Let a be an integer and m be a positive integer. We denote by.
3.4/3.5 The Integers and Division/ Primes and Greatest Common Divisors Let each of a and b be integers. We say that a divides b, in symbols a | b, provided.
MATH 224 – Discrete Mathematics
Mathematics in OI Prepared by Ivan Li. Mathematics in OI Greatest Common Divisor Finding Primes High Precision Arithmetic Partial Sum and Differencing.
CompSci 102 Discrete Math for Computer Science February 16, 2012 Prof. Rodger.
Chapter 2 Binary Values and Number Systems. 2 2 Natural Numbers Zero and any number obtained by repeatedly adding one to it. Examples: 100, 0, 45645,
The Integers. The Division Algorithms A high-school question: Compute 58/17. We can write 58 as 58 = 3 (17) + 7 This forms illustrates the answer: “3.
CompSci 102 Discrete Math for Computer Science
Copyright © Zeph Grunschlag, Basic Number Theory Zeph Grunschlag.
Copyright © 2009 Pearson Education, Inc. Chapter 5 Section 1 - Slide 1 Chapter 1 Number Theory and the Real Number System.
Chapter Integers and Algorithms Representations of integers
Foundations of Discrete Mathematics Chapter 4 By Dr. Dalia M. Gil, Ph.D.
Module #9 – Number Theory 1/5/ Algorithms, The Integers and Matrices.
Slide Copyright © 2009 Pearson Education, Inc. Unit 1 Number Theory MM-150 SURVEY OF MATHEMATICS – Jody Harris.
Greatest Common Divisors & Least Common Multiples  Definition 4 Let a and b be integers, not both zero. The largest integer d such that d|a and d|b is.
Factor A factor of an integer is any integer that divides the given integer with no remainder.
Ref: Pfleeger96, Ch.31 Properties of Arithmetic Reference: Pfleeger, Charles P., Security in Computing, 2nd Edition, Prentice Hall, 1996.
AF2. Turn off your phones Primes, gcd, some examples, reading.
Discrete Mathematics
Slide Copyright © 2009 Pearson Education, Inc. 5.1 Number Theory.
AF2. Turn off your phones Primes, gcd, some examples, reading.
1 Discrete Structures – CNS2300 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (5 th Edition) Chapter 2 The Fundamentals: Algorithms,
Chapter 4 With Question/Answer Animations 1. Chapter Summary Divisibility and Modular Arithmetic - Sec 4.1 – Lecture 16 Integer Representations and 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
Module #9 – Number Theory 6/11/20161 Chapter 3 Algorithms, Integers and Matrices.
Number Theory Lecture 1 Text book: Discrete Mathematics and its Applications, 7 th Edition.
Slide Copyright © 2009 Pearson Education, Inc. Slide Copyright © 2009 Pearson Education, Inc. Chapter 1 Number Theory and the Real Number System.
Chapter 3 The Fundamentals: Algorithms, the integers, and matrices Section 3.4: The integers and division Number theory: the part of mathematics involving.
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
CMPS 2433 – Coding Theory Chapter 3
CSE15 Discrete Mathematics 03/15/17
Integers and Division Section 3.4.
CMSC Discrete Structures
Thinking Critically 4.1 Divisibility Of Natural Numbers
CSE 504 Discrete Mathematics & Foundations of Computer Science
Number Theory and Cryptography
Exercise 24 ÷ 2 12.
MATH301- DISCRETE MATHEMATICS Copyright © Nahid Sultana Dr. Nahid Sultana Chapter 4: Number Theory and Cryptography.
Applied Discrete Mathematics Week 3: Algorithms
Applied Discrete Mathematics Week 4: Number Theory
Foundations of Discrete Mathematics
Enough Mathematical Appetizers!
CMSC 203, Section 0401 Discrete Structures Fall 2004 Matt Gaston
Copyright © Zeph Grunschlag,
Introduction to Number Theory
Divisibility and Modular Arithmetic
Applied Discrete Mathematics Week 10: Introduction to Counting
Number Theory.
Presentation transcript:

Agenda Review:  Relation Properties Lecture Content:  Divisor and Prime Number  Binary, Octal, Hexadecimal Review & Exercise

Review: Relation Properties

Relation: Definition Let A and B be sets. A binary relation from A to B is a subset of A  B. Cartesian Product IF R : binary relation THEN a R b: (a, b)  R a R b: (a, b)  R Notation: domain: {a  A | (a,b)  R for some b  B} range: {b  B | (a,b)  R for some a  A}

Relation Properties Reflexive, Symmetric, Transitive: Antisymmetric Note: first, second, and third points need not be distinct

Example

Divisor and Prime Number

Divisors  Definition: Let n and d be integers, d ≠ 0. We say that d divides n if there exists an integer q satisfying n = dq. We call q the quotient and d a divisor or factor of n. If d divides n, we write d | n. If d does not divide n, we write d | n.  Example: Since 21 = 3·7, 3 divides 21 and we write 3 | 21. The quotient is 7. We call 3 a divisor or factor or 21. Show that if n and d are positive integers and d | n, then d ≤ n.

Divisors  Note: Whether an integer d > 0 divides an integer n or not, we obtain a unique quotient q and remainder r as given by the Quotient-Remainder Theorem (See Lecture Week 3): There exist unique integers q (quotient) and r (remainder) satisfying n = dq+ r, 0 ≤ r < d The remainder r equals zero if and only if d divides n.

Divisors  Theorem Let m, n, and d be integers. a)If d | m and d | n, then d | (m+ n). b)If d | m and d | n, then d | (m–n). c)If d | m, then d | mn.

Prime and Composite  Definition An integer greater than 1 whose only positive divisors are itself and 1 is called prime. An integer greater than 1 that is not prime is called composite.  Examples -Show that the integer 23 is prime. -Divisors: 1, 23 -Show that the integer 34 is composite. -Divisors: 1, 2, 17, 34

Testing for Composite or Prime

Example

 If the input the earlier algorithm is n = 1274, the algorithm returns the prime 2 because 2 divides 1274, specifically 1274 = 2·637.  If we input n = 637, we get the prime 7, specifically 637 = 7·91.  With n = 91, we get the prime 7 again, specifically 91 = 7·13.  If we now input n= 13, the algorithm returns 0 because 13 is prime.  Combining the previous equations, we get 1274 = 2·7·7·13  note: product of Primes

Fundamental Theorem of Arithmetic Any integer greater than 1 can be written as a product of primes. Moreover, if the primes are written in nondecreasing order, the factorization is unique. In symbols, if n= p 1 p 2 ···p i, where the p k are primes and p 1 ≤p 2 ≤ ··· ≤ p i, and n= p’ 1 p’ 2 ···p’ j, where the p’ k are primes and p’ 1 ≤ p’ 2 ≤ ··· ≤ p’ j, then i = j and p k = p’ k for all k= 1,..., i.

Greatest Common Divisor  Definition Let m and n be integers with not both m and n zero. A common divisor of m and n is an integer that divides both m and n. The greatest common divisor, written gcd(m,n), is the largest common divisor of m and n.  Example What is the greatest common divisor of 30 and 105? We can find the answer by enumerating the positive divisors of each number. We can also find the answer by inspecting the prime factorization of each number.

Greatest Common Divisor

Greatest Common Divisor: Example What is the greatest common divisor of and ? = = gcd(82320,950796) = 2 min(4,2) · 3 min(1,2) ·5 min(1,0) ·7 min(3,4) ·11 min(0,1) = 2 2 ·3 1 ·5 0 ·7 3 ·11 0 = 4116.

Least Common Multiple  Definition Let m and n be positive integers. A common multiple of m and n is an integer that is divisible by both m and n. The least common multiple, written lcm(m,n), is the smallest positive common multiple of m and n.  Example The least common multiple of 30 and 105 Use the “list all divisors” method. Use the prime factorization method.

Least Common Multiple

Lcm and Gcd What is the least common multiple of and ? = = lcm(82320,950796) = 2 max(4,2) · 3 max(1,2) ·5 max(1,0) ·7 max(3,4) ·11 max(0,1) = 2 4 ·3 2 ·5 1 ·7 4 ·11 1 = Theorem: For any positive integers m and n, gcd(m,n). Lcm(m,n) = mn

Representation of Integer

Bits In computer data and instruction are encoded as bits. A bit is a binary digit, a 0 or a 1. -Binary number system: represents integer using bits. Other number system: -Decimal number system: represents integer using 10 symbols: 0,1,2,3,4,5,6,7,8,9 -Hexadecimal number system: represents integer using 16 symbols.

Decimal 3854 = 3 * * * * 10 0 =  Base 10.  Symbol: 0 - 9

Binary  Base 2  Symbol: 0, 1 Binary to Decimal: 1110 = 1 * * * * 2 0 = = 14

Decimal to Binary N is an integer N = 1 * 2 k + b k-1 * 2 k-1 + … + b 0 * ? 2) 130 remainder 0 2) 65 remainder 1 2) 32 remainder 0 2) 16 remainder 0 2) 8 remainder 0 2) 4 remainder 0 2) 2 remainder 0 2) 1 remainder 1 0 

Data type with number of bits Byte: 8 bits, range: -128 s/d +127 Short: 16 bits, -2 8 s/d 2 7 Integer: 32 bits Long: 64 bits Float: 32 bits Double: 64 bits

Binary Addition = ?

Negative in Binary Two's complement: 1  0 0  1 Add 1 5 = (Type data: byte) -5 = = Positive: Starting with 0 Negative: Starting with 1

Negative in Binary: 4 bits

Negative in Binary: 8 bits

Hexadecimal  Base 16  Symbol 0 – 9, A, B, C, D, E, F  0 – 9, 10, 11, 12, 13, 14, 15 (Hexadecimal to Decimal) B4F = 11 * * * 16 0 = 11 * * * 1 = 2895

Decimal to Hexadecimal N is an integer N = 1 * 16 k + b k-1 * 16 k-1 + … + b 0 * ? 16) remainder 16) 1274 remainder 1 16) 79 remainder 10 16) 4 remainder 15 4  4FA1

Hexadecimal Addition 84F + 42EA = ? 4B39

Euclidean Algorithm

Efficient algorithm for finding the greatest common divisor of two integers. E.g. application: cryptosystem Based on Theorem: If a is a nonnegative integer, b is a positive integer, and r = a mod b, then gcd(a,b) = gcd(b,r).

Euclidean Algorithm