Popular recipes tagged "mathematical" but not "bits"http://code.activestate.com/recipes/tags/mathematical-bits/2010-07-26T16:32:08-07:00ActiveState Code RecipesMartin Gardner's "The Monkey and the Coconuts" Problem (Python) 2010-07-26T16:32:08-07:00Jack Trainorhttp://code.activestate.com/recipes/users/4076953/http://code.activestate.com/recipes/577335-martin-gardners-the-monkey-and-the-coconuts-proble/ <p style="color: grey"> Python recipe 577335 by <a href="/recipes/users/4076953/">Jack Trainor</a> (<a href="/recipes/tags/martingardner/">martingardner</a>, <a href="/recipes/tags/mathematical/">mathematical</a>, <a href="/recipes/tags/puzzle/">puzzle</a>). </p> <p>Five sailors arrive at a deserted island that has only coconuts and one monkey. The sailors collect all the coconuts into one big pile and agree to divide up the coconuts into equal shares the next morning. However during the night each sailor wakes up one at a time afraid to trust the others and decides to take his share secretly. So each sailor takes 1/5 of the coconuts and hides it. Each time there is one coconut left over and the sailor gives that to the monkey. In the morning they divide what is left of the pile into equal shares and there is still one coconut left for the monkey.</p> <p>How many coconuts were in the original pile?</p>