Exercise · Volume 1 · 1.1-4
Exercise 1.1-4
not stated yet in Lean solution written
| Rating | 16 |
|---|---|
| Kind | K3, find a value: compute a number, a set or a closed form from the written solution |
| Section | Section 1.1 of Volume 1. Companion chapter: Algorithms |
The task
Find with Euclid's algorithm.
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
Start with and in Algorithm E. The first pass swaps the numbers.
Hint 2
At each pass divide the larger by the smaller and keep the remainder.
Solution
Show the solution
The passes of Algorithm E, with the quotient and remainder of step E1, are in the table.
| quotient | |||
|---|---|---|---|
| 2166 | 6099 | 0 | 2166 |
| 6099 | 2166 | 2 | 1767 |
| 2166 | 1767 | 1 | 399 |
| 1767 | 399 | 4 | 171 |
| 399 | 171 | 2 | 57 |
| 171 | 57 | 3 | 0 |
In the last pass , so the answer is the value of then, which is .
Check
Factor the numbers: and . The common part is . Also and , and and have no common factor.
Remarks
Algorithm E does 6 divisions here, and the first one is the wasted swap. The numbers and are the quotients and , and Exercise 1.1-6 studies how many divisions a typical input needs.
This solution is checked, 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.