Thrun presented a bonus question at the beginning of Unit 2 about dividing piles of coconuts and uneven remainders. It goes like this:

Five men and a monkey were shipwrecked on a desert island, and they spent the first day day gathering coconuts for food. Piled them all up together and then went to sleep for the night.

But when they were all asleep one man woke up, and he thought there might be a row about dividing the coconuts in the morning, so he decided to take his share. So he divided the coconuts into five piles. He had one coconut left over, and gave it to the monkey, and he hid his pile and put the rest back together.

By and by, the next man woke up and did the same thing. And he had one left over and he gave it to the monkey. And all five of the men did the same thing, one after the other; each one taking the fifth of the coconuts in the pile when he woke up, and each one having one left over for the monkey. And in the morning they divided what coconuts were left. After dividing the coconuts into five equal shares, they again have one coconut left over, which they gave to the monkey. Of course each one must have known that there were coconuts missing; but each one was guilty as the others, so they didn’t say anything. How many coconuts there were in the beginning?

I sat down with my pen and solved this the long way by hand, like my old physics problems when I was in school. The answer I can up with was 5^{6}-4. This left me very unsatisfied, I know that I solved it, but I knew it was the long way, and that to me was the wrong way.

I had a professor in college for graduate level courses (e&m and mathematical physics). Every week, we would have a new proof to complete. He would remind throughout the course, that every one of his assignments could be solved the short way or the long way. You could solve it in several pages of messy algebra. Or, you could solve in half a page with an elegant proof. He would only give full credit for the half page elegant proof.

I only gave myself partial credit on this coconut problem.

Thrun’s explanation didn’t really satisfy me, but then I saw Mercher’s intuitive explanation on reddit. And it finally clicked. Here is my explanation of his intuitive solution:

As Thrun explained, -4 is a possible answer, but we need a positive solution, so let’s go about finding one.

- Start with N+4 coconuts.
- Split the coconuts into two piles: -4 & N
- Then, each step do the following:
- From the pile of -4, do the process of take 1, multiply by 4/5. (You can do this forever.)
- From the pile of N, just multiply by 4/5

- Repeat step 3 five times.
- You now have one pile of -4 coconuts, and one pile of N*4
^{6}/5^{6}coconuts. From this, it is clear that N must be a multiple of 5^{6}. The smallest such number being…5^{6.}

=> The original pile of of N-4 coconuts == 5^{6} - 4

Now that’s a half-page, full-credit solution.