CSE 20 DISCRETE MATH. Winter

Similar documents
CSE 20 DISCRETE MATH. Fall

CSE 20 DISCRETE MATH. Fall

CSE 20 DISCRETE MATH WINTER

Chapter 2 (Part 3): The Fundamentals: Algorithms, the Integers & Matrices. Integers & Algorithms (2.5)

MATH Dr. Halimah Alshehri Dr. Halimah Alshehri

CSE 20 DISCRETE MATH. Winter

CSE 20 DISCRETE MATH. Winter

CSE 20 DISCRETE MATH. Fall

CSE 20 DISCRETE MATH. Fall

1 Computing System 2. 2 Data Representation Number Systems 22

Introduction CSE 541

CSE 20 DISCRETE MATH. Fall

CSE 20 DISCRETE MATH WINTER

CSE 20 DISCRETE MATH. Winter

Number Theory: Representations of Integers

Conversions between Decimal and Binary

CSE 20: Discrete Mathematics

CSE 20 DISCRETE MATH WINTER

Counting in Different Number Systems

NUMBERS AND CODES CHAPTER Numbers

14:332:231 DIGITAL LOGIC DESIGN. Why Binary Number System?

Searching Algorithms. CSE21 Winter 2017, Day 3 (B00), Day 2 (A00) January 13, 2017

Math.3336: Discrete Mathematics. Primes and Greatest Common Divisors

Discrete Mathematics GCD, LCM, RSA Algorithm

COT 3100 Applications of Discrete Structures Dr. Michael P. Frank

Trinity Web Site Design. Today we will learn about the technology of numbering systems.

ECE380 Digital Logic. Positional representation

With Question/Answer Animations. Chapter 4

Banneker Middle School. Summer Math Packet C2.0 Algebra 1

3 The fundamentals: Algorithms, the integers, and matrices

CHAPTER 1 REAL NUMBERS KEY POINTS

CSE 20 DISCRETE MATH WINTER

HW1 graded review form? HW2 released CSE 20 DISCRETE MATH. Fall

CSE 20 DISCRETE MATH SPRING

Question Details SPreCalc [ ] Question Details SPreCalc MI. [ ]

Algorithms: Review from last time

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF

ENGIN 112 Intro to Electrical and Computer Engineering

4 Number Theory and Cryptography

ENGIN 112 Intro to Electrical and Computer Engineering

2.5 정수와알고리즘 (Integers and Algorithms)

Numbering Systems. Contents: Binary & Decimal. Converting From: B D, D B. Arithmetic operation on Binary.

Base-b representations of integers. (b 진법표현 ) Algorithms for computer arithmetic: Euclidean algorithm for finding GCD s.

Argyle Magnet Middle School Summer Math Packet ANSWERS

12/31/2010. Digital Operations and Computations Course Notes. 01-Number Systems Text: Unit 1. Overview. What is a Digital System?

Computer Arithmetic. MATH 375 Numerical Analysis. J. Robert Buchanan. Fall Department of Mathematics. J. Robert Buchanan Computer Arithmetic

CSE 105 THEORY OF COMPUTATION

Standard forms for writing numbers

CSC 125 :: Final Exam December 14, 2011

CSE 20 DISCRETE MATH WINTER

Scientific Notation. exploration. 1. Complete the table of values for the powers of ten M8N1.j. 110 Holt Mathematics

Menu. Review of Number Systems EEL3701 EEL3701. Math. Review of number systems >Binary math >Signed number systems

Computer Number Systems

Week No. 06: Numbering Systems

ECE 372 Microcontroller Design

We say that the base of the decimal number system is ten, represented by the symbol

GED Prep Live: Number Sense & Basic Algebra

Informatics 1 - Computation & Logic: Tutorial 3

17.1 Binary Codes Normal numbers we use are in base 10, which are called decimal numbers. Each digit can be 10 possible numbers: 0, 1, 2, 9.

Chapter 5. Number Theory. 5.1 Base b representations

1. Consider the conditional E = p q r. Use de Morgan s laws to write simplified versions of the following : The negation of E : 5 points

Welcome to CSE21! Lecture B Miles Jones MWF 9-9:50pm PCYN 109. Lecture D Russell (Impagliazzo) MWF 4-4:50am Center 101

Foundations of Mathematics and Pre-Calculus 10. Sample Questions for Algebra and Number. Teacher Version

WE SAY THAT A SQUARE ROOT RADICAL is simplified, or in its simplest form, when the radicand has no square factors.

Binary addition example worked out

MATH 114 Fall 2004 Solutions to practice problems for Final Exam

Introduction Integers. Discrete Mathematics Andrei Bulatov

Problem Points Score Total 100

Modesto Junior College Course Outline of Record MATH 70

Time Analysis of Sorting and Searching Algorithms

Orders and Equivalences

Natural Whole Integer Rational Irrational Real. Sep 8 6:51 AM. Today we are starting our first non review unit REAL NUMBERS

Statements and Quantifiers

Clock Arithmetic. 1. If it is 9 o clock and you get out of school in 4 hours, when do you get out of school?

Next, we include the several conversion from type to type.

Chapter 1 CSCI

CS220/MATH320 Applied Discrete Math Fall 2018 Instructor: Marc Pomplun. Assignment #3. Sample Solutions

Intermediate Math Circles February 14, 2018 Contest Prep: Number Theory

Common Core State Standards for Mathematics

and LCM (a, b, c) LCM ( a, b) LCM ( b, c) LCM ( a, c)

Chapter 1 Computer Arithmetic

CSEN102 Introduction to Computer Science

9.1 SEQUENCES AND SERIES

Part I, Number Systems. CS131 Mathematics for Computer Scientists II Note 1 INTEGERS

CSE 20 DISCRETE MATH. Winter

CISC 1400 Discrete Structures

Number Bases: Dr Olga Maleva

Degree of a polynomial

Assessment Management. Math Boxes 7 3. Math Journal 2, p. 218 Students practice and maintain skills through Math Box problems.

CLICKERS!!!!! Multiply.

MAT 243 Test 2 SOLUTIONS, FORM A

Mat Week 8. Week 8. gcd() Mat Bases. Integers & Computers. Linear Combos. Week 8. Induction Proofs. Fall 2013

8. Sequences, Series, and Probability 8.1. SEQUENCES AND SERIES

cse 311: foundations of computing Fall 2015 Lecture 12: Primes, GCD, applications

Arithmetic, Algebra, Number Theory

Math From Scratch Lesson 29: Decimal Representation

Math 3361-Modern Algebra Lecture 08 9/26/ Cardinality

Student Responsibilities Week 8. Mat Section 3.6 Integers and Algorithms. Algorithm to Find gcd()

Notes. Number Theory: Applications. Notes. Number Theory: Applications. Notes. Hash Functions I

CS1800 Discrete Structures Final Version A

Transcription:

CSE 20 DISCRETE MATH There are 10 types of people in the world: those who understand binary and those who don't. Winter 2017 http://cseweb.ucsd.edu/classes/wi17/cse20-ab/

Today's learning goals Define the decimal, binary, hexadecimal, and octal expansions of a positive integer. Convert between expansions in different bases of a positive integer. Define and use the DIV and MOD operators.

About you MANDE B-210: AC PETER 108: AC To change your remote frequency 1. Press and hold power button until flashing 2. Enter two-letter code 3. Checkmark / green light indicates success How many people in this class have you met so far? A. None. B. Less than 5. C. 5-10. D. 10-15. E. More than 15.

Algorithms! From last time An algorithm is a finite sequence of precise instructions for performing a computation or for solving a problem. arithmetic optimization Input Output

Representation log 2 (32) 101

Integer representations Different contexts call for different representations. Base 10 Base 2

Bases and algorithms 142 x 17 142 = 1 x 100 + 4 x 10 + 2 x 1 17 = 1 x 10 + 7 x 1 Decimal expansion: Write numbers as sums of multiples of powers of 10

Powers of 10 142 = 1 x 10 2 + 4 x 10 1 + 2 x 10 0 17 = 1 x 10 1 + 7 x 10 0 If n is a positive integer and we express its usual decimal expansion as sums of multiples of power of 10, then A. The exponents of powers of 10 in the sum are all positive. B. There is a largest exponent in the sum. C. A multiple of a missing power of 10 can be added in without changing the value of the sum. D. More than one of the above. E. I don't know.

Powers of 10 142 = 1 x 10 2 + 4 x 10 1 + 2 x 10 0 17 = 1 x 10 1 + 7 x 10 0 If n is a positive integer and we express its usual decimal expansion as sums of multiples of power of 10, then A. The coefficient of each term must be nonnegative. B. The coefficient of each term must be less than 10. C. The same coefficient can appear in more than one term. D. More than one of the above. E. I don't know.

Powers of b Rosen p. 246 For base b (integer greater than 1) and positive integer n there is a unique choice of k, a nonnegative integer a 0, a 1, a 2, a 3,, a k-1 integers between 0 and b-1, where a k-1 0 and n = a k-1 b k-1 + + a 1 b + a 0

Powers of 2 For what positive integer k can we choose a 0, a 1, a 2,, a k-1 so that a k 0 and each a i is 0 or 1 with 17 = a k-1 2 k-1 + + a 1 2 + a 0 A. k = 17 B. k = 2 C. k = 4 D. k = 5 E. I don't know.

Powers of 2 Find positive integer k and coefficients a 0, a 1, a 2,, a k-1 so that 17 = a k-1 2 k-1 + + a 1 2 + a 0 = 16 + 1 = 1*2 4 + 1 So k=5 and a 4 =1, a 3 =0, a 2 =0, a 1 =0, a 0 =1.

Base expansion Rosen p. 246 Notation: for positive integer n Write when n = (a k-1 a 1 a 0 ) b n = a k-1 b k-1 + + a 1 b + a 0 Base b expansion of n

Common bases Rosen p. 246 Decimal expansion base 10 (17) 10 Binary expansion base 2 (10001) 2 Octal expansion base 8 ( ) 8 Hexadecimal expansion base 16 ( ) 16

Common bases Rosen p. 246 Decimal expansion base 10 Binary expansion base 2 Octal expansion base 8 Hexadecimal expansion base 16 (17) 10 (10001) 2 ( 21 ) 8 ( 11 ) 16

Common bases Rosen p. 246 Decimal expansion base 10 Binary expansion base 2 Octal expansion base 8 Hexadecimal expansion base 16 What's different? (17) 10 (10001) 2 ( 21 ) 8 ( 11 ) 16

Hexadecimal coefficients 0 1 2 3 4 5 6 7 8 9 A B C D E F

Base expansion In what base could this expansion be (1401)? A. Binary (base 2) B. Octal (base 8) C. Decimal (base 10) D. Hexadecimal (base 16) E. More than one of the above

Base expansion In what base could this expansion be (1401)? A. Binary (base 2) B. Octal (base 8) Value: 1*8 3 +4*8 2 +1=768 C. Decimal (base 10) Value: 1*10 3 +4*10 2 +1=1401 D. Hexadecimal (base 16) Value: 1*16 3 +4*16 2 +1=5121 E. More than one of the above

Algorithm: constructing base b expansion Rosen p. 249 Input n,b Output k, coefficients in expansion English description. Pseudocode.

Algorithm: constructing base b expansion Rosen p. 249 Input n,b Output k, coefficients in expansion English description. Find k Work down to find a k-1, then a k-2, etc. What's the the base 3 expansion of 17? A. (10001) 3 B. (210) 3 C. (111) 3 D. (222) 3 E. None of the above.

Algorithm: constructing base b expansion Rosen p. 249 Input n,b Output k, coefficients in expansion English description. Find k Work down to find a k-1, then a k-2, etc. What's the length of the base b expansion of n? Start with related question: What's the smallest power of b that is bigger than n?

Algorithm: constructing base b expansion Rosen p. 249 Input n,b Output k, coefficients in expansion English description. Find k by computing successive powers of b until find smallest k such that b k-1 n < b k For each value of i from 1 to k Set a k-i to be the largest number between 0 and b-1 for which a k-i b k-i n. Update current value remaining n := n - a k-i b k-i

Algorithm: constructing base b expansion Rosen p. 249 Input n,b Output k, coefficients in expansion English description. Find k by computing successive powers of b until find smallest k such that b k-1 n < b k For each value of i from 1 to k Set a k-i to be the largest number between 0 and b-1 for which a k-i b k-i n. Update current value remaining n := n - a k-i b k-i Definite? Finite? Correct? Challenge: translate to pseudocode!

Arithmetic + Representations Rosen p. 251 What is the sum of (110) 2 and (101) 2? A. (011) 2 B. (111) 2 C. (1011) 2 D. (1001) 2 E. I don't know

Arithmetic + Representations Rosen p. 251 What is the product of (110) 2 and (101) 2? How can we check our work? What about in other bases?

Reminders Homework 1 due Sunday at noon Set up course tools Pseudocode and algorithms + number representations Office hours There are 10 types of people in the world: those who understand ternary, those who don't, and those who mistake it for binary (Ternary means base 3)