Exercise · Volume 1 · 1.3.1-2
Exercise 1.3.1-2
not stated yet in Lean solution written
| Rating | 02 |
|---|---|
| Kind | K3, find a value: compute a number, a set or a closed form from the written solution |
| Section | Section 1.3.1 of Volume 1. Companion chapter: Description of MIX |
The task
Find the number of adjacent bytes that always suffice to hold an integer up to .
The exact wording is in your copy of the book.
Hints
Open one hint at a time. Try the exercise again after each.
Hint 1
The size of a byte is not fixed. Use the smallest legal byte size, .
Hint 2
Compare and with .
Solution
Show the solution
The program must be right for every byte size from to . With the value of four bytes is at most , which is less than . So four bytes are not enough. Five bytes hold up to , which is more than , and this is true for every larger . The answer is five bytes.
Check
python3: 64**4 = 16777216 < 10**8 <= 64**5 = 1073741824. For the number would suffice, but that is not allowed as an assumption.
Remarks
The same reasoning shows why a 10-digit decimal word is the safe size for the whole word: the sign and five bytes, with the value at most .
This solution is drafted, and a person has not reviewed it yet. The source.
In Lean
not stated yet The exercise is not stated in Lean yet.
The status is computed from the Lean build. The node of the map.
Something is wrong? Report it.