1 Discrete Structures – CNS2300 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (5 th Edition) Chapter 2 The Fundamentals: Algorithms,

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

Sets, Combinatorics, Probability, and Number Theory Mathematical Structures for Computer Science Chapter 3 Copyright © 2006 W.H. Freeman & Co.MSCS Slides.
1 Section 2.4 The Integers and Division. 2 Number Theory Branch of mathematics that includes (among other things): –divisibility –greatest common divisor.
22C:19 Discrete Math Integers and Modular Arithmetic Fall 2010 Sukumar Ghosh.
Number Theory and Cryptography
 Instructor: Rob Nash  Readings: Berger, Chapter 1; Rosen, Chapter 3.
Announcements: Homework 1 returned. Comments from Kevin? Homework 1 returned. Comments from Kevin? Matlab: tutorial available at
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):
Chapter 4: Elementary Number Theory and Methods of Proof
Number System Conversions Lecture L2.2 Section 2.3.
Fall 2002CMSC Discrete Structures1 Let us get into… Number Theory.
BY MISS FARAH ADIBAH ADNAN IMK
CSCI 1900 Discrete Structures
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 3 (Part 2): The Fundamentals: Algorithms, the.
Chapter 2 The Fundamentals: Algorithms, the Integers, and Matrices
© 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
1 Discrete Structures – CNS2300 Text Discrete Mathematics and Its Applications Kenneth H. Rosen Chapter 3 Mathematical Reasoning, Induction and Recursion.
CompSci 102 Discrete Math for Computer Science February 16, 2012 Prof. Rodger.
Cryptography Inverses and GCD Piotr Faliszewski. GCD(a,b) gcd(a, 0) = a gcd(a, b) = gcd(b, a mod b) a = b*q + r Here: q =  a / b  r = a mod b (a –
Chapter 2: The Logic of Compound Statements 2.5 Application: Number Systems and Circuits for Addition 1 Counting in binary is just like counting in decimal.
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
Section 2.6 Representation of numbers. Decimal representation (base 10) Given a positive integer X, the decimal representation of X is a string of digits.
MAT 320 Spring 2008 Section 1.2.  Start with two integers for which you want to find the GCD. Apply the division algorithm, dividing the smaller number.
Chapter Integers and Algorithms Representations of integers
Number Theory 이재원 School of Information Technology Sungshin W. University.
Scott CH Huang COM5336 Cryptography Lecture 11 Euclidean Domains & Division Algorithm Scott CH Huang COM 5336 Cryptography Lecture 10.
1 Discrete Structures – CNS2300 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (5 th Edition) Chapter 3 The Foundations: Logic and Proof,
Foundations of Discrete Mathematics Chapter 4 By Dr. Dalia M. Gil, Ph.D.
이산수학 (Discrete Mathematics) 2.5 정수와 알고리즘 (Integers and Algorithms) 2006 년 봄학기 문양세 강원대학교 컴퓨터과학과.
Application: Algorithms Lecture 20 Section 3.8 Wed, Feb 21, 2007.
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.
1 Discrete Structures – CNS2300 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (5 th Edition) Chapter 2 The Fundamentals: Algorithms,
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.
R. Johnsonbaugh, Discrete Mathematics 5 th edition, 2001 Chapter 3 Algorithms.
1 Discrete Structures – CNS2300 Text Discrete Mathematics and Its Applications (5 th Edition) Kenneth H. Rosen Chapter 7 Relations.
Application: Algorithms Lecture 19 Section 3.8 Tue, Feb 20, 2007.
1 Discrete Structures – CNS2300 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (5 th Edition) Chapter 1 The Foundations: Logic, Sets,
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 Lecture 1 Text book: Discrete Mathematics and its Applications, 7 th Edition.
Direct Proof and Counterexample III Part 2 Lecture 16 Section 3.3 Tue, Feb 13, 2007.
Agenda Review:  Relation Properties Lecture Content:  Divisor and Prime Number  Binary, Octal, Hexadecimal Review & Exercise.
Number Theory. Introduction to Number Theory Number theory is about integers and their properties. We will start with the basic principles of divisibility,
The Euclidean Algorithm
CS 210 Discrete Mathematics The Integers and Division (Section 3.4)
Discrete Structures – CNS2300
CMSC Discrete Structures
CSE 504 Discrete Mathematics & Foundations of Computer Science
Number Theory and Cryptography
MATH301- DISCRETE MATHEMATICS Copyright © Nahid Sultana Dr. Nahid Sultana Chapter 4: Number Theory and Cryptography.
Applied Discrete Mathematics Week 4: Number Theory
Foundations of Discrete Mathematics
Week #5 – 23/25/27 September 2002 Prof. Marie desJardins
CMSC 203, Section 0401 Discrete Structures Fall 2004 Matt Gaston
Copyright © Zeph Grunschlag,
Application: Algorithms
Application: Algorithms
Divisibility and Modular Arithmetic
Number Theory.
Discrete Mathematics Chapter 4 Number Theory. Discrete Mathematics Chapter 4 Number Theory.
Sets, Combinatorics, Probability, and Number Theory
Presentation transcript:

1 Discrete Structures – CNS2300 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (5 th Edition) Chapter 2 The Fundamentals: Algorithms, the Integers, and Matrices

2 Section 2.5 Integers and Algorithms

3 Lemma (A short theorem not used for much except proving another theorem) Let a = bq + r, where a,b,q and r are integers. Then gcd(a,b) = gcd(b,r)

4 Euclidean Algorithm procedure gcd(a,b: positive integers) x := a y := b while y > 0 begin r := x mod y x := y y := r end {gcd(a,b) is x}

5 Example 18 = (1)(12) = (2)(6) + 0 gcd(12,18)

6 Example 18 = (1)(12) = (2)(6) + 0 gcd(12,18)

7 Example gcd(123,277) 277 = (2)(123) = (3)(31) = (1)(30) = (30)(1) + 0

8 Representation of Integers Let b be a positive integer greater than 1. Then if n is a positive integer, it can be expressed uniquely in the form where k is a nonnegative integer, a 0,a 1,…,a k are nonnegative integers less than b, and Which means?????

9 You can change bases 351 = ( ) = ( 537) = (15F) = (253) 12

10 People There are only 10 types of people. Those who understand binary numbers and those who don’t.

11 How? 351 = (29)(12) = (2)(12) = (0)(12) + 2 The remainders tell us the number in base = Convert 351 to base 12

12 Convert 351 to base 16 (hex) 351 = 21(16) + 15 (F in base 16) 21 = 1(16) +5 Therefore 351 = 15F 16 1 = 0(16) +1

13 How About the Other Way? = = 351

14 Special Relationships

15 Special Relationships

16 Special Relationships

17 Special Relationships

18 Special Relationships = 537 8

19 Try it Again

20 This time, group by 4 bits F

21 Special Relationships F5

22 Special Relationships F51

23 Special Relationships F = 15F 16

E M range

25 Addition of Integers procedure add(a,b: positive integers) c := 0 for j := 0 to n-1 begin d := (a j + b j + c)/2 s j := a j + b j + c - 2d c := d end s n := c

26 Multiplying Integers procedure multiply(a,b: positive integers) for j := 0 to n-1 begin if b j = 1 then c j := a shifted j places else c j := 0 end p := 0 for j := 0 to n - 1 p := p + c j

27 finished