Combinatorics contest math question

216 Views Asked by At

James has a red jar,a blue jar and a pile of 100 pebbles.Initially both jars are empty. A move consists of moving a pebble from the pile into one of the jars or returning a pebble from one of the jars to the pile. The numbers of pebbles In the red and blue jars determine the state of the game. The following conditions must be satisfied:

a)The red jar may never contain fewer pebbles than the blue jar;

b)The game may never be returned to a previous state.

What is the maximum number of moves that James can make?

1

There are 1 best solutions below

7
On BEST ANSWER

For the sake of simplicy I'll solve the problem for $N=10$, leaving it up to you to extrapolate it for any given $N$.

Denote the number of pebbles in the red jar with $x$ and the number of pebbles in the blue jar with $y$. Represent allowed values for $x$ and $y$ in a plane and you get a shaded triangle. This shaded area represent the limits imposed in your problem: $x+y\le10$ and $x\ge y$. Each point with integer coordinates (including those on triangle edges) represent a valid state of your problem.

enter image description here

If you connect all game states you get a path. That path cannot use each valid point more than once (states cannot repeat). The length of the path represent the number of state transitions. A path of maximum lenght is obviously a solution to your problem.

One possible path of length 16 (with 17 points and 16 state transitions) is shown below:

enter image description here

Blue points have even value of $x+y$. Points with odd value of $x+y$ have red color. Notice that colors always change between consecutive points.

Let's count the total number of valid ($x,y$) points counting them from the bottom of the triangle: $11 + 9 + 7 + 5 + 3 + 1=36$

The number of red points can be determined in the same way: $5+4+3+2+1=15$. So if you use all red points, the maximum number of points in the path is $2\times15+1=31$, which means 30 state transitions.

Now we know the upper limit but is it reachable? Is it possible to construct such a path? Yes, in a fairly simple and straightforward way which is applicable to any number of pebbles. The following path has 31 points and 30 state transitions.

Please see detailed explanation of Ronald Blaak here who actually solve the most important part of this problem HERE

enter image description here

It can be shown that for any given (even) N, the maximum number of state transitions is:

$$2 + 4 + 6 + ... + N=\frac{N}{4}(N+2)$$