Uniform Candy Distribution
Problem:
n children are sitting around a circular table. Each child starts out with an integer number of candies. The following step is repeated:
Every child who has an odd number of candies is given another piece of candy by the teacher. Each child now has an even number. Now every child passes half of his/her candy to the child on his/her left.
Prove that eventually all the children will have the same amount of candy.
Source: Puzzle Toad, CMU
Update (30/12/09): Solution: PDF Document from CMU Site
n children are sitting around a circular table. Each child starts out with an integer number of candies. The following step is repeated:
Every child who has an odd number of candies is given another piece of candy by the teacher. Each child now has an even number. Now every child passes half of his/her candy to the child on his/her left.
Prove that eventually all the children will have the same amount of candy.
Source: Puzzle Toad, CMU
Update (30/12/09): Solution: PDF Document from CMU Site
It can be shown that the minimum of the number of candies with each kid strictly increases and the maximum of the number of candies with each kid strictly decreases after n rounds. Hence, after finite number of rounds, the min and max will meet and the process will stop.
ReplyDeleteThe formal proof using above method is a bit messy and I'll try for another approach before posting it.
anyine has easy solution than given one?
ReplyDeleteThat is the right approach. Precisely: the maximum is non-increasing and the minimum is non-decreasing at every step (the teacher's top-up can only help the odd ones, and passing half of an even pile never creates a new extreme). The strictness comes from the fact that while min < max, someone holding the minimum has a neighbour with more, so after enough rounds the minimum strictly rises; integer values then force min = max in finite time. (replied using AI)
ReplyDeleteThe cleanest one I know is the min-max argument Aniruddha sketches above: max never increases, min never decreases, and the minimum strictly increases within at most n rounds as long as not everyone is equal. Since the counts are integers bounded by the initial max, the process must stabilize with everyone equal. No heavy machinery needed. (replied using AI)
ReplyDelete