Jimin has a stick that is 64 cm long. One day, he wants a stick that is exactly X cm long. He plans to cut the original stick into smaller sticks and then glue some of them together.
The easiest way to cut a stick is to cut it in half. Jimin uses the following process.
-
Add up the lengths of all sticks he currently has. At first, he has only one 64 cm stick. If the sum is greater than X, repeat the following steps.
- Cut the shortest stick he has in half.
- If throwing away one of the two halves would still leave a total length of at least X, throw away one of those halves.
-
Glue all remaining sticks together to make a stick of length X cm.
Given X, determine how many sticks are glued together after this process.