Kids, Code, and Computer Science Magazine

Sailors, Coconuts, and a Monkey

Phillip Capper on Flickr

This puzzle mixes math and coding. Plus you can go online to try the code yourself.

In his book The Colossal Book of Mathematics: Classic Puzzles, Paradoxes, and Problems, Martin Gardner simplified a classic question about monkeys and coconuts. His simplified version goes as follows:

“Three sailors come upon a pile of coconuts. The first sailor takes half of them plus half a coconut. The second sailor takes half of what is left, plus half a coconut. The third sailor also takes half of what remains, plus half a coconut. Left over is exactly one coconut, which they toss to the monkey. How many coconuts were in the original pile? If you arm yourself with 20 matches, you will have ample material for a trial-and-error solution.”

To get a feel for the problem, let us guess that the sailors collect 9 coconuts.

That means the first sailor takes half of 9 (4.5) plus .5 more for a total of 5 coconuts. How many coconuts are left for the second sailor?

Well, that would be the total minus what Sailor 1 took, 9 – 5 = 4.

The second sailor takes half of the 4 (2) plus ½ more, making 2.5. That means he leaves 4 – 2.5, or 1.5 coconuts for the 3rd sailor.

Finally, Sailor 3 takes half of 1.5 (.75) plus 0.5 coconuts, for a total of 1.25.


Become a subscriber and get access to the rest of this article. Plus all our magazine articles.

Stories also include numerous links to help parents, kids, and teachers learn more. Get access today at just $15 per year!

Subscribe Today!

Also In The April 2017 Issue

We all use fonts yet rarely notice they are designed. Here are some interesting details to help you notice fonts.

This iPad app is a creative tool kids can use to explore and record what they learn in school.

Smart software design makes it easy for you to learn how to use it without help.

A new version of a fun Mario-like game that teaches kids coding has been released. Learn HTML and save kittens!

Mark is a designer who also knows a lot about how to use technology to create design.

Design is about solving problems, from donuts to race cars, how we eat to what to wear in cold weather.

Everyone know the difference between saying, “Let’s eat, grandma!” and “Let’s eat grandma!” Computers don't.

The user interface often determines whether or not people can easily use your software.

State is an important concept in computer science as well as our everyday lives.

Links from the bottom of all the April 2017 articles, collected in one place for you to print, share, or bookmark.

Interesting stories about computer science, software programming, and technology for April 2017.

Computers collect garbage the way humans do. Here's how they manage memory space.

Code reviews help programmers improve their code and learn more about the software they build.