View Single Post
  #19  
Old 11-19-2005, 11:18 AM
Guest
 
Posts: n/a
Default Re: math riddle: King and His Prisoners (no content, long)

I guess I will add to my previous post.

Break the prisoners into two groups: one counter, and then everyone else (n-1).

The counter follows these rules when called:
1. If the cup is down, do nothing.
2. If the cup is up, flip it down and increment running total.

The (n-1) non-counters do this:
1. If the cup is up, do nothing.
2. If the cup is down, flip it unless you have flipped it Y times already.

We need to find some number where the counter can be certain that everyone has been in the room. If you analyze the strategy you see that the King can use his flips to drive the largest possible count up or down as he sees fit.

We are looking for the condition where all prisoners have been in the room. (1)

The largest count that can exist without (1) being met is A*(n-2) + k. This is all but 1 non-counting prisoner using the max. flips and the King using all of his moves to drive up the count.

When all prisoners have been in the room, the count will lie between [0,A*(n-1)+k] In fact, the count will never increase beyond A*(n-1)+k given the strategy we have defined. Given all of the King's strategies, the smallest UPPER bound is A*(n-1)-k. So the upper bound must lie on [A*(n-1)-k,A*(n-1)+k]

If we can find an A, such that A*(n-1)-k is greater than A*(n-2)+k then we have our solution. Why? Because we have found a count that we are guaranteed to eventually reach that is larger than any count where (1) is not met.

A(n-1)-k > A(n-2) + k
- A - k > - 2A + k
A > 2k
The smallest such A is 2k+1, but any A larger than that will also work.

(2k+1)(n-1) - k = 2kn + n - 3k - 1
When the count reaches '2kn + n - 3k - 1' the counter can say "Yes"
Reply With Quote