These are optional exercises for practicing the concepts we learned this week.
What is the approximate value of
a) 214
b) 232
c) 88
What is the approximate value of
a) log2(8,000,000,000)
b) log16(16,000,000)
A notebook computer's disk holds 500 Gb (gigabytes) of data. We would like to send the data across an extremely slow network that transfers only 1 byte/second. Approximately how long will the transfer take?
Is this statement true or false?
For all n ∈ ℤ, n2 mod 4 < 2.
Prove your answer.
What is 1101002 in base 10? What is ab16 in base 10?
What is 9510 in base 2? In base 16?
What is 678 in base 10?
What is 6710 in base 8?
A byte holds a value from 010 to 25510. In hexadecimal, what is the smallest and largest value that can be stored in a byte?
How many digits does 10010 have when written in base 5? How many digits does 50010 have when written in the same base?
Write a program that reads an integer N (in decimal), and prints out all values from 0 to N in binary representation, with one number per line.
Let's say that a number is
light if its binary representation has more 0s than 1s
heavy if its binary representation has more 1s than 0s
balanced if its binary representation has the same number of 0s and 1s
Write a program that reads a decimal integer and reports whether it is light, heavy, or balanced.
Write a program that reads a number written in base 7, and writes the number in base 3.
Write a program that reads an integer N and prints out N with its digits reversed. Do not use any strings (except for reading the input) or lists. You must reverse the digits using arithmetic operations only.
Hint: extract N's digits in order from least significant to most significant; use those to build an integer K in which the least significant digit of N becomes the most significant digit of K.