Let be a positive integer. Two squirrels, Bushy and Jumpy, have collected walnuts for the winter. One day, Jumpy noticed that Bushy have made the walnuts into piles, with a single walnut in each pile. “That’s way too many piles!” Unhappy, Jumpy decides to do the following actions: for each action, he chooses two piles, take equal amounts of walnuts from the two piles, and combine them into a new pile. Jumpy’s goal is to make , the number of nonempty piles, as small as possible. For each positive integer , find the smallest possible that Jumpy can achieve through finitely many actions.
, 2023
Solution
If is a power of 2, then the minimum ; otherwise, the minimum .
When , we only need to repeatedly take any two piles with the fewest walnuts, take all their walnuts and combine them, and eventually we can end up with a single pile, which is clearly the smallest possible value of .
Now consider . Below, we use -pile to denote a pile with walnuts. Consider the following operations:
1. First, from the initial piles we select piles, then repeatedly take any two piles among them with the fewest walnuts, take all their walnuts and combine them, and eventually we can end up with one -pile together with 1-piles. Call this -pile the XL pile.
2. Next, from the XL pile and a 1-pile we each take one walnut, forming a 2-pile. If , then we again take one walnut each from the XL pile and the 2-pile. Repeat this action until the XL pile has walnuts left. At this point we have one -pile, one 2-pile, and 1-piles.
3. We then pair up and combine all the 1-piles, thereby obtaining 2-piles. Then, from these piles, repeatedly take the two smallest piles and combine them, and eventually we will obtain a -pile. At this point we are left with one -pile and one -pile, so .
We only need to prove that when is not a power of 2, it is impossible to reduce the operations to a single pile. First note that if we select an -pile and a -pile, and each time take walnuts, then we have
Also note that if there exists an odd integer dividing , then we must necessarily have and .
Now, since is not a power of 2, it must have an odd factor . If we finally end up with a single -pile, then according to the discussion above, the number of walnuts in every initial 1-pile must be divisible by , which is obviously a contradiction. Hence when is not a power of 2, the minimum value of is 2.