A co-worker proposed this “little quiz” today:
There are 5 Monkeys and a number of apples. They want to divide the apples into equal shares, but all forget. They all go to sleep. In the middle of the night, the first monkey suddenly remembers, and goes and divides the apples into five equal groups. He finds out that there is an extra, and eats it. Then, he hides his share and goes to sleep. The second monkey remembers ten minutes later, divides the apples, and finds out there is an extra. He eats the extra, hides his share and goes to sleep. The third, fourth, and fifth all do the same process, and at the end, there are still many apples left. Assuming that the monkeys didn’t cut any apples, what is the least number of apples that there could’ve been at the beginning?
See my solution here: http://jsfiddle.net/PTvgC/4/