All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Logic
The prisoners and the beans (Posted on 2005-11-27) Difficulty: 3 of 5
Five prisoners are going to take beans from a bag with 100 beans. They will do it one prisoner at a time, and only once each. No communication is allowed between them, but they can count the beans left in the bag. All prisoners who end with the largest and the smallest number of beans will die.

Who is most likely to survive?

1. they are all smart people.
2. they will try to survive first and then try to kill more people.
3. they do not need to take out all the 100 beans.

See The Solution Submitted by pcbouhid    
Rating: 3.8000 (15 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
No beans left -- Easier to read version | Comment 3 of 38 |

This is probably a lot easier to read, but it uses terminology to make things easier to read.

The first prisoner will be called ONE, the second, TWO, down to the fifth being called FIVE.

The current lowest number of beans is called LOW, (so LOW+1 would be the lowest number of beans, plus one), and the highest number of beans is HIGH.

The word "save" means forcing a past prisoner to not die, or allowing a future prisoner not to die. (If everyone is going to die, saving someone isn't allowed.)

You can assume that if someone will die, they will try to kill everyone else. This adds in an interesting twist, because if the first in a chunk will die, he will try to pick a number of beans to kill as many as possible. For example, one simple possibility is the first player taking all 100 beans, and leaving none for everyone else. This means everyone will die (which is the most people he can kill), but the first player will only choose this if there's no way for him to survive. (He will kill any number of people if it means his own survival.)

If the first player takes more than 20 beans, the second player can save himself by taking HIGH-1, which isn't allowed. Since this is true, a prisoner will never take more than LOW+2, and leave more than LOW beans, (that would save someone), nor leave fewer than LOW beans, (that would save the previous person who took LOW)

So this leaves two cases. A player could take LOW beans, or the fourth player could leave LOW beans. Both of these would end up with all players getting killed.

Case 1: Taking LOW+1 beans: Each player would take LOW or LOW+1 beans, as taking LOW+2 would save whoever said LOW+1, or less than LOW would save the person who took LOW. 

Case 2: Taking beans to leave LOW: This is just a special case, and only works if everyone has taken LOW. Instead of taking the same number of beans as everyone else, the fourth prisoner could leave LOW. (The fifth prisoner won't take less than that, because that saves the first three prisoners.) All five prisoners would die in this case as well.

Other than these cases, a prisoner will only take less than or equal to LOW. (Because of the foresight of previous prisoners, a prisoner can't save himself by leaving fewer beans than he took.) A prisoner will also not take HIGH-2, because then the next prisoner can save himself by taking HIGH-1. So he has to take LOW (or he can take LOW-1 if nobody has taken LOW+1 yet)

This continues on to the fifth prisoner, who can take any amount he wants, as everyone will die no matter what. So everyone will die no matter what, so either the first prisoner can take all 100 beans to make sure everyone is killed, or he can take some other number 20 or less and everyone will insure that everyone else dies.

  Posted by Gamer on 2005-11-27 15:35:47
Please log in:
Remember me:
Sign up! | Forgot password

Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (12)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Copyright © 2002 - 2020 by Animus Pactum Consulting. All rights reserved. Privacy Information