Chapter 3: Computing with Base-n Numbers

We are all accustomed to decimal (base-10) numbers. In this chapter, we will introduce numbers in other bases, describe arithmetic operations with those numbers, and convert numbers from one base to another. We will then move to binary digits (base-2), which are the foundation on which all computer operations are built, develop an approach to efficient arithmetic with them, and look at some of the core uses of binary, including Boolean algebra. Lastly, we will discuss hexadecimal (base-16) numbers and their uses in computer science. We will use Python code to do some computations such as converting decimal numbers to binary and hexadecimal and use Boolean operators to select and view data that satisfies ...

Get Practical Discrete Mathematics now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.