# Balls fitted in empty boxes

There are 12 empty boxes in a row. Every now and then, someone places a ball in one of the boxes and at the same time removes at least one of the balls in the neighbouring boxes (if there exists). What is the largest possible number of balls in boxes (each box can be fitted only with one ball)?

I am not sure - by intuition I would say 5.

• Do you mean an emotional '!' or the mathematical one...? The latter, called 'factorial', would make $5! = 120$ so I suppose you rather mean an expression of emotion – but please avoid it, just to be clear. :-) – CiaPan Oct 18 '17 at 16:24
• There is an ambiguity here when you say that the person "removes at least on of the balls in the neighbouring boxes". One can take that to mean that of each of the neighboring boxes at least one ball gets removed, or that at least one ball gets removed between all the neighboring boxes. Which is it? – Bram28 Oct 18 '17 at 17:38
• @Marius Stephant I solved your problem about the trapezoid. – Michael Rozenberg Oct 25 '17 at 20:11

Hint: adding a ball to box 7 and removing a ball from box 6 is equivalent to moving a ball from box 6 to box 7. So, at every step, you can either

1. move a ball in one of the boxes to an adjacent empty box, or

2. add a ball to an empty box whose neighbors are empty

As we are not limited to the number of balls we can have in each box, the answer would be infinity

Now, supposing that each box can have at most 1 ball, we can do the following:

1. Put a ball on the box 1
2. Put a ball on the box 3
3. Put a ball on the box 2 (removing the ball from the box 3)

Now we have 2 balls (on the boxes 1 and 2); now we just have to repeat steps 2 and 3 to add more balls on the boxes 3, 4, 5...; at the end the answer would be $n-1$, if my logic is correct

• Ah! Your answer made me realize there is an ambiguity in the problem description. – Bram28 Oct 18 '17 at 17:37

No, it's 6: you can put a ball in boxes 1,3,5,7,9, and 11 without ever retrieving one. (of course, that's not a proof that the maximum is 6, but it's at least 6, and my intuition says 6 is the maximum :) )