Took along hiatus from the Riddler, but I’m back!

For those that aren’t familiar, The Riddler is a weekly puzzle series from Oliver Roeder at FiveThirtyEight that usually involves some combination of math, logic and probability.

This weeks FiveThirtyEight Riddler, How Many Bananas Does it Take to Lead a Camel to Market?:

sYou have a camel and 3,000 bananas. (Because of course you do.) You would like to sell your bananas at the bazaar 1,000 miles away. Your loyal camel can carry at most 1,000 bananas at a time. However, it has an insatiable appetite and quite the nose for bananas — if you have bananas with you, it will demand one banana per mile traveled. In the absence of bananas on his back, it will happily walk as far as needed to get more bananas, loyal beast that it is. What should you do to get the largest number of bananas to the bazaar? What is that number?

So just in order to get to the market, you need a minimum of 1,000 bananas, and since that just gets you there without any bananas to sell, a more creative solution is required. Let’s say we split the 3,000 bananas into 3 piles – Pile A, Pile B, & Pile C. From there we move Pile A one mile, go back and do the same for Piles B & C.

Mile | Pile A | Pile B | Pile C |
---|---|---|---|

0 | 1000 | 1000 | 1000 |

1 | 999 | 999 | 999 |

This won’t get us anywhere, since at mile 1,000 we’ll be left with 0 bananas in each. Let’s instead redistribute the Pile C bananas to Pile A and Pile B.

Mile | Pile A | Pile B | Pile C |
---|---|---|---|

0 | 1000 | 1000 | 1000 |

1 | 999 | 999 | 999 |

1 | 1000 | 1000 | 997 |

Now if we were to just move each pile forward without redistribution we’d end up with 2 bananas to sell at the market (1 from Pile A and 1 from Pile B). Let’s redistribute the bananas every mile, now it looks like:

Mile | Pile A | Pile B | Pile C |
---|---|---|---|

0 | 1000 | 1000 | 1000 |

1 | 999 | 999 | 999 |

1 | 1000 | 1000 | 997 |

2 | 999 | 999 | 996 |

2 | 1000 | 1000 | 995 |

3 | 999 | 999 | 994 |

3 | 1000 | 1000 | 992 |

A pattern starts to emerge, every mile takes 3 bananas, specifically from Pile C. For now, let’s say:

Bananas in Pile C = 1000 – 3*Miles Traveled

Now let’s look at Mile 333, about when Pile C would be exhausted.

Mile | Pile A | Pile B | Pile C |
---|---|---|---|

333 | 1000 | 1000 | 1 |

334 | 999 | 999 | 0 |

Since we only have 1 banana left in Pile C, we can’t redistribute it. So we’re now 667 miles away from our destination, with 2 piles of 1,000 bananas each. Let’s continue this redistribution strategy with Piles A and Pile B (redistributing Pile B)

Mile | Pile A | Pile B | Pile C |
---|---|---|---|

334 | 999 | 999 | 0 |

334 | 1000 | 998 | 0 |

335 | 999 | 997 | 0 |

335 | 1000 | 995 | 0 |

Now another pattern emerges for Pile B. The amount of bananas in Pile B can be described as:

Bananas in Pile B = 1000 – 2*(Miles Traveled-333)

Using this we see that Pile B runs out bananas around mile 833.

Mile | Pile A | Pile B | Pile C |
---|---|---|---|

832 | 1000 | 2 | 0 |

833 | 999 | 1 | 0 |

833 | 1000 | 0 | 0 |

At this point, we can simply just carry Pile A, feeding a banana to the camel every mile for the last 177 miles. The amount of bananas left when we reach the market is simply 1000 – 177 = 833.

**To answer the original Riddler question, the largest amount of bananas that we can get to the bazaar under the current circumstances is 833.**

833