# What is a logical solution to this problem?

Monkey beans. An urn contains 23 white beans and 34 black beans. A monkey takes out two beans; if they are the same, he puts a black bean into the urn, and if they are different, he puts in a white bean from a large heap he has next to him. The monkey repeats this procedure until there is only one bean left. What colour is it?

The way I've tried to go about this, is that I use trial and error whereby I say for instance two black beads are chosen then you add one black beads (as they're the same) then next I get a black AND white bead, and then I add one white bead. However with this reasoning it would take me quite a while to find the answer. I've also seen if it's easier backwards, so I assume the last colour is black and then go from there, or do it the other way with the white colour being the last one. But again there are many possible turn-outs through that as well.

• I got a laugh from the choice of infinite repetend by Mr Cannabis, but somebody should edit that wall of deleted text to be shorter. I can't because it is locked.
– zyx
Aug 29, 2013 at 19:18

There are three possibilities on each turn: he removes BW and returns W, which leaves the number of white beans unchanged; he removes BB and returns B, which leaves the number of white beans unchanged; or he removes WW and returns B, which reduces the number of white beans by $2$. Since he started with $23$ white beans, he always has an odd number of white beans in the urn. In particular, when the urn gets down to one bean, it must be white.
In problems of this general type it’s usually a good idea to try to identify some invariant, something that remains unchanged at each step. In this case that turns out to be the parity (evenness or oddness) of the number of white beans: that number always changes by $0$ or $2$, so if it starts odd, it remains odd, and if it starts even, it remains even.