Date: Thu, 17 Apr 1997 11:13:25 -0400

From:

I couldn't get my copy of netscape to work with your reply form, so I'll try to replicate it as best I can:

My name: Brad (you may use my name)

My email address: (please do not use my email address)

This don't refer to a particular problem.

Title: Bananas

I've enjoyed the various problems presented on your page, so I thought I'd send in this puzzle that I had fun solving. I also wanted to ask if there is a more direct way of solving it. Here it is:

Three men and a monkey are trapped in a room with a pile of bananas. Why, I don't know. The three men agree that when they sleep, one of them must always stay awake to keep the monkey from eating the bananas. The first man on duty decides he wants to eat some bananas, so he gives the monkey one banana and divides the remaining bananas into three equal piles (no fractions of bananas). He then eats all the bananas in one of the piles, and pushes the remaining bananas back into one pile. The next man does the exact same thing-divides the pile into three (having to give one to the monkey to make the piles equal) and eats one of the piles. Without much suprise, the third man does the exact same thing-gives one banana to the monkey, makes three equal piles and eats one pile. They all wake up, give the monkey one banana, divide the bananas up into 3 equal piles and eat the rest of the bananas. How many bananas were there to start with?

My solution was to look at repeated applications of the function: f(x) = 2/3 * (x-1). f(f(f(x))))-1 must be divisable by three. or equivalently f(f(f(x)))) -1 = 3*k (where k is some positive integer) After all the algebra this means that the x we are looking for must be the first integer which satisfies the equation x = (81*k + 65)/8. (if I remember correctly) The only way I found to solve this problem was to try different values of k until I produced an integer. This finally worked with k = 7, yielding x = 79.

Is there a method which doesn't involve repeated trials with different values of k? Thanks for a great webpage!