Maths Olympiad Prep

Library / /305 of 397

, 2023

Combinatorics Difficulty 6.6 National Olympiad Prove it Taiwan

Let nn be a positive integer. Two squirrels, Bushy and Jumpy, have collected nn walnuts for the winter. One day, Jumpy noticed that Bushy have made the walnuts into nn 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 PP, the number of nonempty piles, as small as possible. For each positive integer nn, find the smallest possible PP that Jumpy can achieve through finitely many actions.

Solution

If nn is a power of 2, then the minimum P=1P = 1; otherwise, the minimum P=2P = 2.

When n=2kn = 2^k, 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 PP.

Now consider 2k<n<2k+12^k < n < 2^{k+1}. Below, we use tt-pile to denote a pile with tt walnuts. Consider the following operations:

1. First, from the initial nn piles we select 2k2^k 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 2k2^k-pile together with m=n2km = n - 2^k 1-piles. Call this 2k2^k-pile the XL pile.

2. Next, from the XL pile and a 1-pile we each take one walnut, forming a 2-pile. If m<2k1m < 2^k - 1, then we again take one walnut each from the XL pile and the 2-pile. Repeat this action until the XL pile has mm walnuts left. At this point we have one mm-pile, one 2-pile, and nm2=2k2n - m - 2 = 2^k - 2 1-piles.

3. We then pair up and combine all the 1-piles, thereby obtaining 2k12^{k-1} 2-piles. Then, from these piles, repeatedly take the two smallest piles and combine them, and eventually we will obtain a 2k2^k-pile. At this point we are left with one mm-pile and one 2k2^k-pile, so P=2P = 2.

We only need to prove that when nn is not a power of 2, it is impossible to reduce the operations to a single pile. First note that if we select an aa-pile and a bb-pile, and each time take cmin(a,b)c \le \min(a, b) walnuts, then we have
aac a \to a - c
bbc b \to b - c
02c 0 \to 2c
Also note that if there exists an odd integer qq dividing gcd(ac,bc,2c)\gcd(a-c,b-c,2c), then we must necessarily have qaq|a and qbq|b.

Now, since nn is not a power of 2, it must have an odd factor q>1q > 1. If we finally end up with a single nn-pile, then according to the discussion above, the number of walnuts in every initial 1-pile must be divisible by qq, which is obviously a contradiction. Hence when nn is not a power of 2, the minimum value of PP is 2.

Want a route through all this instead of an archive? The track puts 2,000 problems in a working order, from AMC 10 level to the IMO shortlist.

Source: MathNet, licensed CC-BY-4.0. Statement translated into English from zh; metadata (topic, difficulty) added by this project.