Exercise · Volume 1 · 1.2.4-1
Exercise 1.2.4-1
proved in Lean solution written
| Rating | 00 |
|---|---|
| Kind | K3, find a value: compute a number, a set or a closed form from the written solution |
| Section | Section 1.2.4 of Volume 1. Companion chapter: Integer functions and elementary number theory |
The task
Find five values of the floor and the ceiling function: one for each of the numbers , , , and .
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 floor of is the greatest integer that is at most . The ceiling is the least integer that is at least . Look at the number line, not at the digits.
Hint 2
For the last value, find the powers of that enclose .
Solution
Show the solution
, because .
, because and is the least integer that is at least .
, because . The floor of a negative number goes down, away from zero.
, because .
For : . Take of the chain: . So the floor is .
Check
A computer run with exact arithmetic gives . For the last value, .
Remarks
The pair and is the standard trap: many programming languages truncate toward zero and give for both. See Exercise 1.2.4-4 for the exact link between the two functions.
This solution is checked, and a person has not reviewed it yet. The source.
In Lean
proved The statement and its proof are in Lean. The kernel accepts the proof, and it uses the standard axioms only.
- Problem:
TAOCP.S1_2_4.Ex1.statementaxioms: Classical.choice, Quot.sound, propext - Solution:
TAOCP.S1_2_4.Ex1.solvedaxioms: Classical.choice, Quot.sound, propext
The status is computed from the Lean build. The node of the map.
Something is wrong? Report it.