Chapter 2: Integers and Mathematical Induction Discrete Mathematical Structures: Theory and Applications
Learning Objectives Learn about the basic properties of integers Become aware how integers are represented in computer memory Explore how addition and subtraction operations are performed on binary numbers Learn how the principle of mathematical induction is used to solve problems Discrete Mathematical Structures: Theory and Applications
Learning Objectives Learn about loop invariants and how they are used to prove the correctness of loops Explore various properties of prime numbers Learn about linear Diophantine equations and how to solve them Discrete Mathematical Structures: Theory and Applications
Integers Properties of Integers Discrete Mathematical Structures: Theory and Applications
Integers Discrete Mathematical Structures: Theory and Applications
Integers Discrete Mathematical Structures: Theory and Applications
Integers Discrete Mathematical Structures: Theory and Applications
Integers Discrete Mathematical Structures: Theory and Applications
Integers The div and mod operators div mod Examples: 8 div 5 = 1 a div b = the quotient of a and b obtained by dividing a on b. Examples: 8 div 5 = 1 13 div 3 = 4 mod a mod b = the remainder of a and b obtained by dividing a on b 8 mod 5 = 3 13 mod 3 = 1 Discrete Mathematical Structures: Theory and Applications
Integers Discrete Mathematical Structures: Theory and Applications
Integers Discrete Mathematical Structures: Theory and Applications
Integers Discrete Mathematical Structures: Theory and Applications
Integers Relatively Prime Number Discrete Mathematical Structures: Theory and Applications
Integers Least Common Multiples Discrete Mathematical Structures: Theory and Applications
Representation of Integers in Computer Electrical signals are used inside the computer to process information Two types of signals Analog Continuous wave forms used to represent such things as sound Examples: audio tapes, older television signals, etc. Digital Represent information with a sequence of 0s and 1s Examples: compact discs, newer digital HDTV signals Discrete Mathematical Structures: Theory and Applications
Representation of Integers in Computers Digital Signals 0s and 1s – 0s represent low voltage, 1s high voltage Digital signals are more reliable carriers of information than analog signals Can be copied from one device to another with exact precision Machine language is a sequence of 0s and 1s The digit 0 or 1 is called a binary digit , or bit A sequence of 0s and 1s is sometimes referred to as binary code Discrete Mathematical Structures: Theory and Applications
Representation of Integers in Computers Decimal System or Base-10 The digits that are used to represent numbers in base 10 are 0,1,2,3,4,5,6,7,8, and 9 Binary System or Base-2 Computer memory stores numbers in machine language, i.e., as a sequence of 0s and 1s Octal System or Base-8 Digits that are used to represent numbers in base 8 are 0,1,2,3,4,5,6, and 7 Hexadecimal System or Base-16 Digits and letters that are used to represent numbers in base 16 are 0,1,2,3,4,5,6,7,8,9,A ,B ,C ,D ,E , and F Discrete Mathematical Structures: Theory and Applications
Representation of Integers in Computers Discrete Mathematical Structures: Theory and Applications
Representation of Integers in Computers Two’s Complements and Operations on Binary Numbers In computer memory, integers are represented as binary numbers in fixed-length bit strings, such as 8, 16, 32 and 64 Assume that integers are represented as 8-bit fixed-length strings Sign bit is the MSB (Most Significant Bit) Leftmost bit (MSB) = 0, number is positive Leftmost bit (MSB) = 1, number is negative Discrete Mathematical Structures: Theory and Applications
Representation of Integers in Computers Discrete Mathematical Structures: Theory and Applications
Representation of Integers in Computers One’s Complements and Operations on Binary Numbers Discrete Mathematical Structures: Theory and Applications
Representation of Integers in Computers Discrete Mathematical Structures: Theory and Applications
Representation of Integers in Computers Discrete Mathematical Structures: Theory and Applications
Representation of Integers in Computers Discrete Mathematical Structures: Theory and Applications
Representation of Integers in Computers Discrete Mathematical Structures: Theory and Applications
Representation of Integers in Computers Discrete Mathematical Structures: Theory and Applications