Base-b representations of integers. (b 진법표현 ) Algorithms for computer arithmetic: Euclidean algorithm for finding GCD s.
|
|
- Tracey Lindsey
- 5 years ago
- Views:
Transcription
1 이산수학 () 정수와알고리즘 (Integers and Algorithms) 2011년봄학기 강원대학교컴퓨터과학전공문양세
2 Introduction Base-b representations of integers. (b 진법표현 ) Especially: binary, hexadecimal, octal. Also, two s complement representation (2 의보수표현 ) Algorithms for computer arithmetic: Binary addition, multiplication, division. Euclidean algorithm for finding GCD s. Page 2
3 Base-b Representations of Integers If b is a positive integer greater than 1, then a given positive integer n can be uniquely represented as follows: n = a k-1 k b k + a k-1 b + + a 1 b 1 + a 0 b 0 where k is a natural number. and a 0, a 1,, and a k are a natural number less than b. a k 0. Example: 165 = = (165) = = (245) 8 Page 3
4 Base-b Number Systems Ordinarily we write base-10 representations of numbers (using digits 0-9). However, 10 isn t special; any base b>1 will work. For any positive integers n, b, there is a unique sequence a k a k-1 a 1 a 0 of digits a i <b such that n k i 0 i a i b The base b expansion of n (n 의밑수b 전개, n의 b진법표현 ) Page 4
5 Particular Bases of Interest Base b=10 (decimal): 10 digits: 0,1,2,3,4,5,6,7,8,9. Base b=2 2 (binary): 2 digits: 0,1. ( Bits = binary digits. ) Base b=8 (octal): 8 digits: 0,1,2,3,4,5,6,7. Used only because we have 10 fingers Used internally in all modern computers Octal digits correspond to groups of 3 bits Base b=16 (hexadecimal): 16 digits: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F Hex digits give groups of 4 bits Page 5
6 Converting to Base b (1/2) Informal Algorithm 1. To convert any integer n to any base b>1: 2. To find the value of the rightmost (lowest-order) digit, simply compute n mod b. (n%b 로가장끝자리 (digit) 를찾는다.) 3. Now replace n with the quotient n/b. ( 다음자리 (digit) 을구하기위하여, 몫을 n 으로삼는다.) 4. Repeat above two steps to find subsequent digits, until n is gone (=0). ( 단계 2/3 을 n 이 0 이될때까지반복한다.) (177130) 10 = (?) 16 (241) 10 = (?) = = , 120 = = = , 30 = = = , 7 = = = , 1 = = (241) 10 = ( ) 2 (177130) 10 = (2B3EA) 16 Page 6
7 Converting to Base b (2/2) Formal Algorithm procedure base b expansion (n: positive integer) q := n k := 0 while q 0 begin a k := q mod b {remainder} q := q/b {quotient} k := k + 1 end {the base b expansion of n is (a k a k-1 a 1 a 0 ) b } Page 7
8 Addition of Binary Numbers Intuition (let a = (a n-1 a 1 a 0 ) 2, b = (b n-1 b 1 b 0 ) 2 ) c n-1 c n-2... c 1 c 0 c i = (a i-1 +b i-1 +c i-1 )/2 a = a n-1 a n-2... a 2 a 1 a 0 b = b n-1 b n-2... b 2 b 1 b 0 a+b = s n s n-1 s n-2... s 2 s 1 s 0 s i = (a i +b i +c i )%2 Algorithm procedure add(a n 1 a 0, b n 1 b 0 : binary expressions of a,b) c := 0 {c mean a carry} for i := 0 to n 1 {i means a bit index} begin sum := a i + b i + c {2-bit sum} O(n) s i := sum mod 2 {low bit of sum} c := sum/2 {high bit of sum} end s n := c {the binary expression of the sum is (s n s n-1 s 1 s 0 ) 2 } Page 8
9 2 s Complement (2의보수 ) (1/2) In binary, negative numbers can be conveniently represented using 2 s s complement notation. ( 실제로, 컴퓨터에서는음수를 2 의보수로표현한다.) In this scheme, a string of n bits can represent integers 2 n 1 ~ (2 n 1 1). 0 이상의정수만표현한다면 0 ~ 2 n 1 (unsigned int n) 음의정수까지표현한다면 2 n-1 ~ 2 n-1 1 (int n) The bit in the highest-order h bit-position iti (n 1) represents a coefficient multiplying 2 n 1 ; ( 왼쪽첫번째 bit 는 22 n 1 을나타내며, 흔히부호 (+ or ) ) 를의미한다.) The other positions i < n 1 just represent 2 i, as before. Page 9
10 2 s Complement (2의보수 ) (2/2) The negation of any n-bit 2 s complement number a(= a n 1 a 0 ) is given by a n 1 a Bitwise logical complement of a Examples 1011 = ( ) = (0101) = (5) = = (4) 10 Page 10
11 Subtraction of Binary Numbers Theorem: For an integer a represented in 2 s complement notation, a = a + 1. (a 가 2 보수로표현된다면, ) Proof: Just try it by yourself! Algorithm procedure subtract (a n 1 a 0, b n 1 b 0 : binary 2 s complement expressions of a,b) return add(a, add(b, 1)) { a + ( b) } Page 11
12 Multiplication of Binary Numbers (1/2) Intuition (let a = (a n-1 a 1 a 0 ) 2, b = (b n-1 b 1 b 0 ) 2 ) a = a n-1 a n-2... a 2 a 1 a 0 b = b n-1 b n-2... b 2 b 1 b 0 c 0 = s (n-1,0) s (n-2,0)... s (2,0) s (1,0) s (0,0) c 1 = s (n-1,1) s (n-2,1)... s (2,1) s (1,1) s (0,1) 0 c 2 = s (n-1,2) s (n-2,2)... s (2,2) s (1,2) s (0,2) 0 0 +) a b = c n-1 + c n c 2 + c 1 + c 0 s (i,j) = (if b j = 1 then a i else 0) c j = (if b j = 1 then a << j else 0) Page 12
13 Multiplication of Binary Numbers (2/2) Algorithm procedure multiply(a n 1 a 0, b n 1 b 0 : binary expressions of a,b) for j := 0 to n 1 {a bit index for b} begin if b j = 1 then c j := a shifted j places {c j := a << j} else c j := 0 end {c 1, c 2,, c n-1 are the partial products.} p := 0 for j := 0 to n 1 p := add(p, c j ) {p is the value of ab} O(n 2 ) Can be reduced to O(n ) Page 13
14 Division Algorithm Example: 23/4? r q Algorithm 23 4 = = = = = 3 5 procedure division(a, d: positive integer) q := 0 r := a while r d begin r := r d q := q + 1 end {q is the quotient(= a/d ), r is the remainder(=a%d)} Page 14
15 Euclid s Algorithm for GCD Finding GCDs by comparing prime factorizations can be difficult if the prime factors are unknown. ( 소인수분해로최대공약수를구하는것은어렵다. 특히, 큰수인경우 ) Euclid discovered: For all integers a, b, gcd(a, b) = gcd((a mod b), b). Sort a,b so that t a>b, and then (given b>1) (a mod b) < a, so problem is simplified. Examples gcd(372, 164) = gcd(372 mod 164, 164) [372%164 = 44] gcd(164, 44) = gcd(164 mod 44, 44) [164%44 = 32] gcd(44, 32) = gcd(44 mod 32, 32) = gcd(12, 32) = gcd(12, 8) gcd(8, 4) = gcd(4, 0) = 4. Page 15
16 Proof of Euclid s Algorithm Prove gcd(a,b) = gcd(b,r) where r = a bq a 와 b 의공약수는 b 와 r 의공약수가같음을보이면, 양쪽공약수의쌍이같으므로 ( 최대공약수가같아져 ) 증명이이루어진다. d 를 a 와 b 의공약수라하자. 그러면, a = dq a, b = dq b 가성립한다. 정의에의해, r = dq a dq b q= d(q a q b q) ) 이성립하므로, d 는 r 의약수이다. 따라서, d 는 b 와 r 의공약수이다. d 를 b 와 r 의공약수라하자. 그러면, b = dq b, r = dq r 이성립한다. 정의에의해, a = dq r + dq b q= d(q r + q b q) 이성립하므로, d 는 a 의약수이다. 따라서, d 는 a 와 b 의공약수이다. Page 16
17 Euclid s Algorithms Algorithm in Pseudocode procedure gcd(a, b: positive integer) while b 0 begin r := a mod b {r = a % b} a := b b := r end return a Algorithm in C (using recursive calls) int gcd(int a, int b) /* assume a > b */ { if(b==0) return a; else return gcd(b, a%b); } Page 17
2.5 정수와알고리즘 (Integers and Algorithms)
이산수학 () 2.5 정수와알고리즘 (Integers and Algorithms) 2006 년봄학기 문양세강원대학교컴퓨터과학과 Introduction Base-b representations of integers. (b진법표현 ) Especially: binary, hexadecimal, octal. Also, two s complement representation
More informationCOT 3100 Applications of Discrete Structures Dr. Michael P. Frank
University of Florida Dept. of Computer & Information Science & Engineering COT 3100 Applications of Discrete Structures Dr. Michael P. Frank Slides for a Course Based on the Text Discrete Mathematics
More informationDiscrete Mathematics GCD, LCM, RSA Algorithm
Discrete Mathematics GCD, LCM, RSA Algorithm Abdul Hameed http://informationtechnology.pk/pucit abdul.hameed@pucit.edu.pk Lecture 16 Greatest Common Divisor 2 Greatest common divisor The greatest common
More informationChapter 2 (Part 3): The Fundamentals: Algorithms, the Integers & Matrices. Integers & Algorithms (2.5)
CSE 54 Discrete Mathematics & Chapter 2 (Part 3): The Fundamentals: Algorithms, the Integers & Matrices Integers & Algorithms (Section 2.5) by Kenneth H. Rosen, Discrete Mathematics & its Applications,
More informationConversions between Decimal and Binary
Conversions between Decimal and Binary Binary to Decimal Technique - use the definition of a number in a positional number system with base 2 - evaluate the definition formula ( the formula ) using decimal
More informationMat Week 8. Week 8. gcd() Mat Bases. Integers & Computers. Linear Combos. Week 8. Induction Proofs. Fall 2013
Fall 2013 Student Responsibilities Reading: Textbook, Section 3.7, 4.1, & 5.2 Assignments: Sections 3.6, 3.7, 4.1 Proof Worksheets Attendance: Strongly Encouraged Overview 3.6 Integers and Algorithms 3.7
More informationCh 4.2 Divisibility Properties
Ch 4.2 Divisibility Properties - Prime numbers and composite numbers - Procedure for determining whether or not a positive integer is a prime - GCF: procedure for finding gcf (Euclidean Algorithm) - Definition:
More informationStudent Responsibilities Week 8. Mat Section 3.6 Integers and Algorithms. Algorithm to Find gcd()
Student Responsibilities Week 8 Mat 2345 Week 8 Reading: Textbook, Section 3.7, 4.1, & 5.2 Assignments: Sections 3.6, 3.7, 4.1 Induction Proof Worksheets Attendance: Strongly Encouraged Fall 2013 Week
More informationWith Question/Answer Animations. Chapter 4
With Question/Answer Animations Chapter 4 Chapter Motivation Number theory is the part of mathematics devoted to the study of the integers and their properties. Key ideas in number theory include divisibility
More informationMATH Dr. Halimah Alshehri Dr. Halimah Alshehri
MATH 1101 haalshehri@ksu.edu.sa 1 Introduction To Number Systems First Section: Binary System Second Section: Octal Number System Third Section: Hexadecimal System 2 Binary System 3 Binary System The binary
More information3 The fundamentals: Algorithms, the integers, and matrices
3 The fundamentals: Algorithms, the integers, and matrices 3.4 The integers and division This section introduces the basics of number theory number theory is the part of mathematics involving integers
More informationCSE 311: Foundations of Computing. Lecture 12: Two s Complement, Primes, GCD
CSE 311: Foundations of Computing Lecture 12: Two s Complement, Primes, GCD n-bit Unsigned Integer Representation Represent integer as sum of powers of 2: If 2 where each {0,1} then representation is b
More informationcse 311: foundations of computing Fall 2015 Lecture 12: Primes, GCD, applications
cse 311: foundations of computing Fall 2015 Lecture 12: Primes, GCD, applications n-bit unsigned integer representation Represent integer x as sum of powers of 2: If x = n 1 i=0 b i 2 i where each b i
More information4 Number Theory and Cryptography
4 Number Theory and Cryptography 4.1 Divisibility and Modular Arithmetic This section introduces the basics of number theory number theory is the part of mathematics involving integers and their properties.
More information14:332:231 DIGITAL LOGIC DESIGN. Why Binary Number System?
:33:3 DIGITAL LOGIC DESIGN Ivan Marsic, Rutgers University Electrical & Computer Engineering Fall 3 Lecture #: Binary Number System Complement Number Representation X Y Why Binary Number System? Because
More informationMenu. Review of Number Systems EEL3701 EEL3701. Math. Review of number systems >Binary math >Signed number systems
Menu Review of number systems >Binary math >Signed number systems Look into my... 1 Our decimal (base 10 or radix 10) number system is positional. Ex: 9437 10 = 9x10 3 + 4x10 2 + 3x10 1 + 7x10 0 We have
More informationCPSC 467: Cryptography and Computer Security
CPSC 467: Cryptography and Computer Security Michael J. Fischer Lecture 9 September 30, 2015 CPSC 467, Lecture 9 1/47 Fast Exponentiation Algorithms Number Theory Needed for RSA Elementary Number Theory
More informationCSE 311 Lecture 13: Primes and GCD. Emina Torlak and Kevin Zatloukal
CSE 311 Lecture 13: Primes and GCD Emina Torlak and Kevin Zatloukal 1 Topics Modular arithmetic applications A quick wrap-up of Lecture 12. Primes Fundamental theorem of arithmetic, Euclid s theorem, factoring.
More informationFour Important Number Systems
Four Important Number Systems System Why? Remarks Decimal Base 10: (10 fingers) Most used system Binary Base 2: On/Off systems 3-4 times more digits than decimal Octal Base 8: Shorthand notation for working
More informationECE380 Digital Logic. Positional representation
ECE380 Digital Logic Number Representation and Arithmetic Circuits: Number Representation and Unsigned Addition Dr. D. J. Jackson Lecture 16-1 Positional representation First consider integers Begin with
More information4. Number Theory (Part 2)
4. Number Theory (Part 2) Terence Sim Mathematics is the queen of the sciences and number theory is the queen of mathematics. Reading Sections 4.8, 5.2 5.4 of Epp. Carl Friedrich Gauss, 1777 1855 4.3.
More informationThe Euclidean Algorithm and Multiplicative Inverses
1 The Euclidean Algorithm and Multiplicative Inverses Lecture notes for Access 2009 The Euclidean Algorithm is a set of instructions for finding the greatest common divisor of any two positive integers.
More informationCPSC 467b: Cryptography and Computer Security
CPSC 467b: Cryptography and Computer Security Michael J. Fischer Lecture 8 February 1, 2012 CPSC 467b, Lecture 8 1/42 Number Theory Needed for RSA Z n : The integers mod n Modular arithmetic GCD Relatively
More informationNumbering Systems. Contents: Binary & Decimal. Converting From: B D, D B. Arithmetic operation on Binary.
Numbering Systems Contents: Binary & Decimal. Converting From: B D, D B. Arithmetic operation on Binary. Addition & Subtraction using Octal & Hexadecimal 2 s Complement, Subtraction Using 2 s Complement.
More informationcse 311: foundations of computing Spring 2015 Lecture 12: Primes, GCD, applications
cse 311: foundations of computing Spring 2015 Lecture 12: Primes, GCD, applications casting out 3s Theorem: A positive integer n is divisible by 3 if and only if the sum of its decimal digits is divisible
More informationRemainders. We learned how to multiply and divide in elementary
Remainders We learned how to multiply and divide in elementary school. As adults we perform division mostly by pressing the key on a calculator. This key supplies the quotient. In numerical analysis and
More informationEE260: Digital Design, Spring n Digital Computers. n Number Systems. n Representations. n Conversions. n Arithmetic Operations.
EE 260: Introduction to Digital Design Number Systems Yao Zheng Department of Electrical Engineering University of Hawaiʻi at Mānoa Overview n Digital Computers n Number Systems n Representations n Conversions
More informationMath.3336: Discrete Mathematics. Primes and Greatest Common Divisors
Math.3336: Discrete Mathematics Primes and Greatest Common Divisors Instructor: Dr. Blerina Xhabli Department of Mathematics, University of Houston https://www.math.uh.edu/ blerina Email: blerina@math.uh.edu
More informationNumber Theory: Applications. Number Theory Applications. Hash Functions II. Hash Functions III. Pseudorandom Numbers
Number Theory: Applications Number Theory Applications Computer Science & Engineering 235: Discrete Mathematics Christopher M. Bourke cbourke@cse.unl.edu Results from Number Theory have many applications
More informationArithmetic Algorithms, Part 1
Arithmetic Algorithms, Part 1 DPV Chapter 1 Jim Royer EECS January 18, 2019 Royer Arithmetic Algorithms, Part 1 1/ 15 Multiplication à la Français function multiply(a, b) // input: two n-bit integers a
More informationProofs. Methods of Proof Divisibility Floor and Ceiling Contradiction & Contrapositive Euclidean Algorithm. Reading (Epp s textbook)
Proofs Methods of Proof Divisibility Floor and Ceiling Contradiction & Contrapositive Euclidean Algorithm Reading (Epp s textbook) 4.3 4.8 1 Divisibility The notation d n is read d divides n. Symbolically,
More informationNumbers. Çetin Kaya Koç Winter / 18
Çetin Kaya Koç http://koclab.cs.ucsb.edu Winter 2016 1 / 18 Number Systems and Sets We represent the set of integers as Z = {..., 3, 2, 1,0,1,2,3,...} We denote the set of positive integers modulo n as
More informationThe following is an informal description of Euclid s algorithm for finding the greatest common divisor of a pair of numbers:
Divisibility Euclid s algorithm The following is an informal description of Euclid s algorithm for finding the greatest common divisor of a pair of numbers: Divide the smaller number into the larger, and
More informationIntermediate Math Circles February 26, 2014 Diophantine Equations I
Intermediate Math Circles February 26, 2014 Diophantine Equations I 1. An introduction to Diophantine equations A Diophantine equation is a polynomial equation that is intended to be solved over the integers.
More informationCOMP239: Mathematics for Computer Science II. Prof. Chadi Assi EV7.635
COMP239: Mathematics for Computer Science II Prof. Chadi Assi assi@ciise.concordia.ca EV7.635 The Euclidean Algorithm The Euclidean Algorithm Finding the GCD of two numbers using prime factorization is
More informationChapter 5. Number Theory. 5.1 Base b representations
Chapter 5 Number Theory The material in this chapter offers a small glimpse of why a lot of facts that you ve probably nown and used for a long time are true. It also offers some exposure to generalization,
More informationSection Summary. Division Division Algorithm Modular Arithmetic
1 Chapter Motivation Number theory is the part of mathematics devoted to the study of the integers and their properties. Key ideas in number theory include divisibility and the primality of integers. Representations
More informationPart I, Number Systems. CS131 Mathematics for Computer Scientists II Note 1 INTEGERS
CS131 Part I, Number Systems CS131 Mathematics for Computer Scientists II Note 1 INTEGERS The set of all integers will be denoted by Z. So Z = {..., 2, 1, 0, 1, 2,...}. The decimal number system uses the
More informationThis is a recursive algorithm. The procedure is guaranteed to terminate, since the second argument decreases each time.
8 Modular Arithmetic We introduce an operator mod. Let d be a positive integer. For c a nonnegative integer, the value c mod d is the remainder when c is divided by d. For example, c mod d = 0 if and only
More informationLecture Notes. Advanced Discrete Structures COT S
Lecture Notes Advanced Discrete Structures COT 4115.001 S15 2015-01-13 Recap Divisibility Prime Number Theorem Euclid s Lemma Fundamental Theorem of Arithmetic Euclidean Algorithm Basic Notions - Section
More informationENGIN 112 Intro to Electrical and Computer Engineering
ENGIN 112 Intro to Electrical and Computer Engineering Lecture 3 More Number Systems Overview Hexadecimal numbers Related to binary and octal numbers Conversion between hexadecimal, octal and binary Value
More informationNotes. Number Theory: Applications. Notes. Number Theory: Applications. Notes. Hash Functions I
Number Theory: Applications Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry Fall 2007 Computer Science & Engineering 235 Introduction to Discrete Mathematics Sections 3.4 3.7 of Rosen cse235@cse.unl.edu
More information8 Primes and Modular Arithmetic
8 Primes and Modular Arithmetic 8.1 Primes and Factors Over two millennia ago already, people all over the world were considering the properties of numbers. One of the simplest concepts is prime numbers.
More information0,..., r 1 = digits in radix r number system, that is 0 d i r 1 where m i n 1
RADIX r NUMBER SYSTEM Let (N) r be a radix r number in a positional weighting number system, then (N) r = d n 1 r n 1 + + d 0 r 0 d 1 r 1 + + d m r m where: r = radix d i = digit at position i, m i n 1
More information14:332:231 DIGITAL LOGIC DESIGN. 2 s-complement Representation
4:332:23 DIGITAL LOGIC DESIGN Ivan Marsic, Rutgers University Electrical & Computer Engineering Fall 203 Lecture #3: Addition, Subtraction, Multiplication, and Division 2 s-complement Representation RECALL
More informationCS1800 Discrete Structures Fall 2017 October, CS1800 Discrete Structures Midterm Version A
CS1800 Discrete Structures Fall 2017 October, 2017 CS1800 Discrete Structures Midterm Version A Instructions: 1. The exam is closed book and closed notes. You may not use a calculator or any other electronic
More informationENGIN 112 Intro to Electrical and Computer Engineering
ENGIN 112 Intro to Electrical and Computer Engineering Lecture 2 Number Systems Russell Tessier KEB 309 G tessier@ecs.umass.edu Overview The design of computers It all starts with numbers Building circuits
More informationApplied Cryptography and Computer Security CSE 664 Spring 2017
Applied Cryptography and Computer Security Lecture 11: Introduction to Number Theory Department of Computer Science and Engineering University at Buffalo 1 Lecture Outline What we ve covered so far: symmetric
More informationAlgorithms CMSC Basic algorithms in Number Theory: Euclid s algorithm and multiplicative inverse
Algorithms CMSC-27200 Basic algorithms in Number Theory: Euclid s algorithm and multiplicative inverse Instructor: László Babai Last updated 02-14-2015. Z denotes the set of integers. All variables in
More informationMathematical Induction
Mathematical Induction Representation of integers Mathematical Induction Reading (Epp s textbook) 5.1 5.3 1 Representations of Integers Let b be a positive integer greater than 1. Then if n is a positive
More informationCHAPTER 3. Congruences. Congruence: definitions and properties
CHAPTER 3 Congruences Part V of PJE Congruence: definitions and properties Definition. (PJE definition 19.1.1) Let m > 0 be an integer. Integers a and b are congruent modulo m if m divides a b. We write
More informationFall 2015 Lecture 14: Modular congruences. cse 311: foundations of computing
Fall 2015 Lecture 14: Modular congruences cse 311: foundations of computing If a and b are positive integers, then gcd a, b = gcd (b, a mod b) Useful GCD Fact Proof: By definition a = a div b b + (a mod
More information1. (16 points) Circle T if the corresponding statement is True or F if it is False.
Name Solution Key Show All Work!!! Page 1 1. (16 points) Circle T if the corresponding statement is True or F if it is False. T F The sequence {1, 1, 1, 1, 1, 1...} is an example of an Alternating sequence.
More informationCSE 20 DISCRETE MATH. Fall
CSE 20 DISCRETE MATH There are 10 types of people in the world: those who understand binary and those who don't. Fall 2017 http://cseweb.ucsd.edu/classes/fa17/cse20-ab/ Today's learning goals Define the
More informationLecture 4: Number theory
Lecture 4: Number theory Rajat Mittal IIT Kanpur In the next few classes we will talk about the basics of number theory. Number theory studies the properties of natural numbers and is considered one of
More informationnot to be republished NCERT REAL NUMBERS CHAPTER 1 (A) Main Concepts and Results
REAL NUMBERS CHAPTER 1 (A) Main Concepts and Results Euclid s Division Lemma : Given two positive integers a and b, there exist unique integers q and r satisfying a = bq + r, 0 r < b. Euclid s Division
More informationNumber 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:
Number Theory Basics Z = {..., 2, 1, 0, 1, 2,...} For, b Z, we say that divides b if z = b for some z Z Notation: b Fact: for all, b, c Z:, 1, and 0 0 = 0 b and b c = c b and c = (b + c) b and b = ±b 1
More informationCISC-102 Winter 2016 Lecture 11 Greatest Common Divisor
CISC-102 Winter 2016 Lecture 11 Greatest Common Divisor Consider any two integers, a,b, at least one non-zero. If we list the positive divisors in numeric order from smallest to largest, we would get two
More informationNUMBERS AND CODES CHAPTER Numbers
CHAPTER 2 NUMBERS AND CODES 2.1 Numbers When a number such as 101 is given, it is impossible to determine its numerical value. Some may say it is five. Others may say it is one hundred and one. Could it
More informationInduction. Induction. Induction. Induction. Induction. Induction 2/22/2018
The principle of mathematical induction is a useful tool for proving that a certain predicate is true for all natural numbers. It cannot be used to discover theorems, but only to prove them. If we have
More informationIntermediate Math Circles February 29, 2012 Linear Diophantine Equations I
Intermediate Math Circles February 29, 2012 Linear Diophantine Equations I Diophantine equations are equations intended to be solved in the integers. We re going to focus on Linear Diophantine Equations.
More informationThe set of integers will be denoted by Z = {, -3, -2, -1, 0, 1, 2, 3, 4, }
Integers and Division 1 The Integers and Division This area of discrete mathematics belongs to the area of Number Theory. Some applications of the concepts in this section include generating pseudorandom
More informationNumber Theory and Cryptography
. All rights reserved. Authorized only for instructor use in the classroom. No reproduction or further distribution permitted without the prior written consent of McGraw-Hill Education. Number Theory and
More informationA field F is a set of numbers that includes the two numbers 0 and 1 and satisfies the properties:
Byte multiplication 1 Field arithmetic A field F is a set of numbers that includes the two numbers 0 and 1 and satisfies the properties: F is an abelian group under addition, meaning - F is closed under
More informationCISC 1400 Discrete Structures
CISC 1400 Discrete Structures Chapter 2 Sequences What is Sequence? A sequence is an ordered list of objects or elements. For example, 1, 2, 3, 4, 5, 6, 7, 8 Each object/element is called a term. 1 st
More informationMathematical Foundations of Cryptography
Mathematical Foundations of Cryptography Cryptography is based on mathematics In this chapter we study finite fields, the basis of the Advanced Encryption Standard (AES) and elliptical curve cryptography
More informationSets. 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
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 century. Most students have seen sets before. This is intended
More informationECE260: Fundamentals of Computer Engineering
Data Representation & 2 s Complement James Moscola Dept. of Engineering & Computer Science York College of Pennsylvania Based on Computer Organization and Design, 5th Edition by Patterson & Hennessy Data
More informationDigital Systems Overview. Unit 1 Numbering Systems. Why Digital Systems? Levels of Design Abstraction. Dissecting Decimal Numbers
Unit Numbering Systems Fundamentals of Logic Design EE2369 Prof. Eric MacDonald Fall Semester 2003 Digital Systems Overview Digital Systems are Home PC XBOX or Playstation2 Cell phone Network router Data
More informationThe Euclidean Algorithm
MATH 324 Summer 2006 Elementary Number Theory Notes on the Euclidean Algorithm Department of Mathematical and Statistical Sciences University of Alberta The Euclidean Algorithm Given two positive integers
More informationFinite Fields. Mike Reiter
1 Finite Fields Mike Reiter reiter@cs.unc.edu Based on Chapter 4 of: W. Stallings. Cryptography and Network Security, Principles and Practices. 3 rd Edition, 2003. Groups 2 A group G, is a set G of elements
More informationMAT 243 Test 2 SOLUTIONS, FORM A
MAT Test SOLUTIONS, FORM A 1. [10 points] Give a recursive definition for the set of all ordered pairs of integers (x, y) such that x < y. Solution: Let S be the set described above. Note that if (x, y)
More informationcse547, math547 DISCRETE MATHEMATICS Professor Anita Wasilewska
cse547, math547 DISCRETE MATHEMATICS Professor Anita Wasilewska LECTURE 12 CHAPTER 4 NUMBER THEORY PART1: Divisibility PART 2: Primes PART 1: DIVISIBILITY Basic Definitions Definition Given m,n Z, we say
More informationa the relation arb is defined if and only if = 2 k, k
DISCRETE MATHEMATICS Past Paper Questions in Number Theory 1. Prove that 3k + 2 and 5k + 3, k are relatively prime. (Total 6 marks) 2. (a) Given that the integers m and n are such that 3 (m 2 + n 2 ),
More informationExercises 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.
Exercises Exercises 1. Determine whether each of these integers is prime. a) 21 b) 29 c) 71 d) 97 e) 111 f) 143 2. Determine whether each of these integers is prime. a) 19 b) 27 c) 93 d) 101 e) 107 f)
More informationAlgorithms (II) Yu Yu. Shanghai Jiaotong University
Algorithms (II) Yu Yu Shanghai Jiaotong University Chapter 1. Algorithms with Numbers Two seemingly similar problems Factoring: Given a number N, express it as a product of its prime factors. Primality:
More informationDirect Proof MAT231. Fall Transition to Higher Mathematics. MAT231 (Transition to Higher Math) Direct Proof Fall / 24
Direct Proof MAT231 Transition to Higher Mathematics Fall 2014 MAT231 (Transition to Higher Math) Direct Proof Fall 2014 1 / 24 Outline 1 Overview of Proof 2 Theorems 3 Definitions 4 Direct Proof 5 Using
More information2301 Assignment 1 Due Friday 19th March, 2 pm
Show all your work. Justify your solutions. Answers without justification will not receive full marks. Only hand in the problems on page 2. Practice Problems Question 1. Prove that if a b and a 3c then
More informationLecture 2. The Euclidean Algorithm and Numbers in Other Bases
Lecture 2. The Euclidean Algorithm and Numbers in Other Bases At the end of Lecture 1, we gave formulas for the greatest common divisor GCD (a, b), and the least common multiple LCM (a, b) of two integers
More information4 Powers of an Element; Cyclic Groups
4 Powers of an Element; Cyclic Groups Notation When considering an abstract group (G, ), we will often simplify notation as follows x y will be expressed as xy (x y) z will be expressed as xyz x (y z)
More informationCSEN102 Introduction to Computer Science
CSEN102 Introduction to Computer Science Lecture 7: Representing Information I Prof. Dr. Slim Abdennadher Dr. Mohammed Salem, slim.abdennadher@guc.edu.eg, mohammed.salem@guc.edu.eg German University Cairo,
More informationHakim Weatherspoon CS 3410 Computer Science Cornell University
Hakim Weatherspoon CS 3410 Computer Science Cornell University The slides are the product of many rounds of teaching CS 3410 by Professors Weatherspoon, Bala, Bracy, and Sirer. memory inst 32 register
More informationBasic elements of number theory
Cryptography Basic elements of number theory Marius Zimand 1 Divisibility, prime numbers By default all the variables, such as a, b, k, etc., denote integer numbers. Divisibility a 0 divides b if b = a
More informationBasic elements of number theory
Cryptography Basic elements of number theory Marius Zimand By default all the variables, such as a, b, k, etc., denote integer numbers. Divisibility a 0 divides b if b = a k for some integer k. Notation
More informationNumber Theory. CSS322: Security and Cryptography. Sirindhorn International Institute of Technology Thammasat University CSS322. Number Theory.
CSS322: Security and Cryptography Sirindhorn International Institute of Technology Thammasat University Prepared by Steven Gordon on 29 December 2011 CSS322Y11S2L06, Steve/Courses/2011/S2/CSS322/Lectures/number.tex,
More informationCS1800 Discrete Structures Final Version A
CS1800 Discrete Structures Fall 2017 Profs. Aslam, Gold, & Pavlu December 11, 2017 CS1800 Discrete Structures Final Version A Instructions: 1. The exam is closed book and closed notes. You may not use
More informationIntroduction to Number Theory. The study of the integers
Introduction to Number Theory The study of the integers of Integers, The set of integers = {... 3, 2, 1, 0, 1, 2, 3,...}. In this lecture, if nothing is said about a variable, it is an integer. Def. We
More informationInduction and recursion. Chapter 5
Induction and recursion Chapter 5 Chapter Summary Mathematical Induction Strong Induction Well-Ordering Recursive Definitions Structural Induction Recursive Algorithms Mathematical Induction Section 5.1
More informationSome Facts from Number Theory
Computer Science 52 Some Facts from Number Theory Fall Semester, 2014 These notes are adapted from a document that was prepared for a different course several years ago. They may be helpful as a summary
More informationBinary addition example worked out
Binary addition example worked out Some terms are given here Exercise: what are these numbers equivalent to in decimal? The initial carry in is implicitly 0 1 1 1 0 (Carries) 1 0 1 1 (Augend) + 1 1 1 0
More informationCHAPTER 1 REAL NUMBERS KEY POINTS
CHAPTER 1 REAL NUMBERS 1. Euclid s division lemma : KEY POINTS For given positive integers a and b there exist unique whole numbers q and r satisfying the relation a = bq + r, 0 r < b. 2. Euclid s division
More information18 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.
118 18. DIVISIBILITY 18 Divisibility Chapter V Theory of the Integers One of the oldest surviving mathematical texts is Euclid s Elements, a collection of 13 books. This book, dating back to several hundred
More informationICS141: Discrete Mathematics for Computer Science I
ICS141: Discrete Mathematics for Computer Science I Dept. Information & Computer Sci., Jan Stelovsky based on slides by Dr. Baek and Dr. Still Originals by Dr. M. P. Frank and Dr. J.L. Gross Provided by
More informationChapter Summary. Mathematical Induction Strong Induction Well-Ordering Recursive Definitions Structural Induction Recursive Algorithms
1 Chapter Summary Mathematical Induction Strong Induction Well-Ordering Recursive Definitions Structural Induction Recursive Algorithms 2 Section 5.1 3 Section Summary Mathematical Induction Examples of
More informationhexadecimal-to-decimal conversion
OTHER NUMBER SYSTEMS: octal (digits 0 to 7) group three binary numbers together and represent as base 8 3564 10 = 110 111 101 100 2 = (6X8 3 ) + (7X8 2 ) + (5X8 1 ) + (4X8 0 ) = 6754 8 hexadecimal (digits
More informationAddition. Ch1 - Algorithms with numbers. Multiplication. al-khwārizmī. al-khwārizmī. Division 53+35=88. Cost? (n number of bits) 13x11=143. Cost?
Ch - Algorithms with numbers Addition Basic arithmetic Addition ultiplication Division odular arithmetic factoring is hard Primality testing 53+35=88 Cost? (n number of bits) O(n) ultiplication al-khwārizmī
More informationCSE 20: Discrete Mathematics
Spring 2018 Summary So far: Today: Logic and proofs Divisibility, modular arithmetics Number Systems More logic definitions and proofs Reading: All of Chap. 1 + Chap 4.1, 4.2. Divisibility P = 5 divides
More informationCSE 241 Digital Systems Spring 2013
CSE 241 Digital Systems Spring 2013 Instructor: Prof. Kui Ren Department of Computer Science and Engineering Lecture slides modified from many online resources and used solely for the educational purpose.
More informationCSCI 255. S i g n e d N u m s / S h i f t i n g / A r i t h m e t i c O p s.
Ying.Yang 1.-1 CSCI 255 http://cs.furman.edu In mathematics, negative integers exists -> forced to do it binary In a binary string, the MSB is sacrificed as the signed bit 0 => Positive Value 1 => Negative
More informationDiscrete Mathematics and Probability Theory Fall 2013 Vazirani Note 3
CS 70 Discrete Mathematics and Probability Theory Fall 2013 Vazirani Note 3 Modular Arithmetic In several settings, such as error-correcting codes and cryptography, we sometimes wish to work over a smaller
More information