N children in a circle, each with some number of candies in hand, a_1,a_2,...,a_n. There is also a basket with unlimited candies.
In each round, each child gives half of his candies to the next child, if a_i is odd, he/she gets one more from the basket to make it even. The process terminates if all children have equal number of candies in hand.
The problem is: Will the process terminate?
Intuitively the answer is yes. But the proof ?
I used to have a better proof but I forgot. Here is the one I have now.
Proof by induction on max-min. Base case is diff=max-min=0, and the process stops without any round. For inductive step, notice that max of all children never increases after a round, while there is at least one min gets killed in one round.
Consider a_i which is min and a_i-1 is strictly larger than min. Then after a round, a_i will be strictly larger than min and a_i-1 stays strictly larger than min, regardless of what a_i-2 is, even if it is min. Therefore after no more than n rounds we killed all min. That is min now increased by at least 2. Applying the inductive hypothesis, we conclude that the process will terminate with max-min = 0
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment