Unit 1.1 Launch
In this note, we illustrate how fundamental knowledge taught in a typical logic course elevates programming from an art to a science. The target audience are learners who have not seen (much) formal logic. Some may have been programming is one or more language for a while. Others may be just starting their journey towards becoming computer scientists. For this reason, we do not expect much in terms of a background. We hope to motivate why acquiring a strong background in logic is important for those who want to become computer scientists. With that, let's dive right in!
Exercise 1.1.
Convert the binary number number \(1 0 1 1 \) into a decimal number.
Let \(y \) represent the desired decimal number. then
Exercise 1.2.
Given a binary number with \(n \) digits represented as
where \(a_0 \) is the least significant digit, what is the formula for computing the equivalent decimal number?
In our example in Exercise 1.1, \(n = 4 \) and \(1011 \) is represented by
The decimal number, \(y \text{,}\) is given by
Another way of talking about a binary number is that it is given in base 2.
Exercise 1.3.
Convert the base 3 number \(2 0 1 2 \) into a decimal number.
Let \(y \) represent the desired decimal number. then
Exercise 1.4.
Given a base 3 number with \(n \) digits represented as
where \(a_0 \) is the least significant digit, what is the formula for computing the equivalent decimal number?
The decimal number, \(y \text{,}\) is given by
Exercise 1.5.
Let \(x \) be an integer greater than \(1 \text{.}\) Given a base \(x \) number with \(n \) digits represented as
where \(a_0 \) is the least significant digit, what is the formula for computing the equivalent decimal number?
The decimal number, \(y \text{,}\) is given by