6Math

Do not worry too much about your difficulties in mathematics, I can assure you that mine are still greater.

Albert Einstein

In this chapter, you will learn some basic math that will help you pass a technical interview and improve as a programmer. While searching for prime numbers might not help you in your day-to-day programming, understanding the different algorithms you can use to find them will make you a better programmer. And while testing your ability to use the modulo operator in your algorithms is one of the most common technical interview “gotchas,” the modulo operator can also be handy in real-world applications. Finally, this chapter introduces the concept of boundary conditions. If you create applications without thinking about boundary conditions, you will likely produce a website or app filled with unexpected errors, so it is important to learn what they are and how to prepare for them.

Binary

Computers “think” in binary. A binary number is a number in the base 2 numeral system. A numeral system is a writing system for expressing numbers. In base 2, numbers have only two digits: 0 and 1. In binary, a digit is called a bit, which stands for binary digit. The number system you are used to counting in is called base 10, and it has 10 digits (zero through nine). A numeral system's base is the number of digits the system has. The binary and decimal numeral systems are not the only number systems. There are also other numeral systems like base 16, called the ...

Get The Self-Taught Computer Scientist 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.