PuzzleReels
Sections

The Pirates and the Gold

The maths · Episode 9 · 2:47 · gives the answer

The puzzle

Five pirates have 100 gold pieces and a strict order of seniority. The most senior proposes a split. Everyone votes, the proposer included. If half or more agree, it stands. Otherwise he goes overboard and the next most senior proposes to those who are left, and so on.

Every pirate is perfectly rational. In order of priority he wants to live, then to have more gold, and only then, when the first two make no difference, to see the proposer drown. A pirate who gets exactly the same gold either way votes no. One who is offered strictly more votes yes.

What does the senior propose?

The maths, properly

Number the pirates 1,2,…,n from the most senior down, and write G for the gold, in whole coins. Here G=100. The rules are the film's, and the proof needs every one of them.

  1. Pirate 1 proposes a split, whole coins adding up to G.
  2. A proposal with n pirates stands if at least ⌈n/2⌉ vote yes. With 5 pirates that is 3, and with two it is 1: a tie passes.
  3. The proposer votes yes, because if his own proposal fails he drowns, and living comes first.
  4. Another pirate votes yes exactly when the proposal gives him strictly more than he would end up with if it failed. A tie means no.

Route one: reason forwards

This is the film's first route, and it fails for a reason that can be counted. To know how pirate k will vote you need to know what he gets if the proposal fails, which is the answer to the game with one pirate fewer, which needs the game with one fewer again. So you must solve every smaller game to judge one proposal.

The splits to weigh grow fast. A split of G coins among n pirates is a way of placing n−1 dividers among G+n−1 slots, so there are

(100+n−1n−1)

of them: 101 for two pirates, 5151 for three, 176,851 for four and 4,598,126 for five. Reasoning forwards means testing each against votes that nobody has worked out yet.

Route two: start at the end

Work from the smallest game up. Each step assumes the answer to the one before, and that is the whole proof, so it is worth seeing both the cases and the pattern.

One pirate takes everything: (100).

Two pirates. The junior would get all 100 if the senior drowned, so he votes no to anything less. But half of two is one, and the senior's own vote is one. So the senior keeps everything: (100, 0). With a strict majority this split would fall, which is why the rule says half or more. The script asserts exactly that.

Three. The bottom pirate gets nothing in the two-pirate game. One coin is more than nothing, so one coin buys his vote, and with the senior's own that is 2 of 3: (99, 0, 1).

Four. Half of four is 2, so one vote besides his own. In the three-pirate game the one who gets nothing is the middle pirate, who is now the third of four. One coin to him: (99, 0, 1, 0).

Five. He needs 3 votes, so two besides his own. In the four-pirate game the pirates who get nothing are the second and the fourth, now the third and the fifth. A coin each: (98, 0, 1, 0, 1).

Proving the pattern

Call the claim P(n). We prove it for 1≤n≤2G+1 by induction on n, which is backward induction written out.

Base. For n=1 the one pirate keeps G, and the formula gives G−0.

Step. Let 2≤n≤2G+1 and suppose P(n−1). Then the split in the (n−1)-game is: the proposer keeps G−⌊(n−2)/2⌋, odd positions from 3 get one coin, the rest get nothing. If the senior's proposal fails he drowns and everyone moves up one place, so pirate k of the n-game is pirate k−1 of the (n−1)-game. Because every proposer in the smaller games survives (the claim says each of them has a passing proposal), what pirate k falls back on is a number of coins, and by rule 4 his vote costs one coin more than that. Price each pirate:

  • Pirate 2 becomes the proposer of the (n−1)-game and keeps G−⌊(n−2)/2⌋. Since n−2≤2G−1, that is at least G−(G−1)=1. So his price is at least 2.
  • Even k≥4 becomes an odd position from 3, which gets one coin. His price is 2.
  • Odd k≥3 becomes an even position, which gets nothing. His price is 1. There are ⌊(n−1)/2⌋ of them.

The senior needs ⌈n/2⌉−1 yes votes besides his own, and that equals ⌊(n−1)/2⌋ (check n even and odd separately). So the number of votes he must buy is exactly the number of pirates priced at 1.

Now the optimum. Any proposal that stands gives at least the price to each of ⌊(n−1)/2⌋ other pirates, so it costs at least the sum of the cheapest ⌊(n−1)/2⌋ prices, which is ⌊(n−1)/2⌋ coins. Paying exactly those prices and nothing else reaches that bound, and the bound is at most G because n≤2G+1. So the proposer keeps G−⌊(n−1)/2⌋≥0, which is the most any passing proposal leaves him. It is the only one: every pirate outside the cheap set costs at least 2, so swapping one in costs at least a coin more, and extra coins to anyone only come out of his share. Hence P(n).

Why one coin, and why those pirates

One coin. Coins come whole and a tie votes no. To win a pirate whose fallback is c you must offer c+1, and offering more buys nothing extra, since a vote is a vote. So a pirate who would get nothing costs one coin.

Those pirates. A pirate's price is what he would get in the (n−1)-game, plus one. The ones who get nothing there are the cheapest, and the cheapest are the ones the senior buys. In the (n−1)-game the paid pirates are the odd positions from 3, so those who got nothing are the even positions, and moving up one place makes them odd again. That is why the bought pirates alternate, and why each step flips who is paid.

Nobody is fooled. The pirate offered one coin is not being tricked, because the alternative is truly nothing. The senior keeps most of the gold because everyone below him can count what happens next.

How far the pattern goes

The proof used n≤2G+1 twice: to keep the cost ⌊(n−1)/2⌋ within G, and to keep pirate 2 from falling back on nothing. For G=100 that is n≤201, and the script checks the closed form against the induction up to there. This is the exact range of the simple pattern under these rules, and past it three things change.

  • n=2G+1 is still the pattern, and the senior keeps nothing: he pays G coins, gets his life, and that is all.
  • n=202 (that is 2G+2). The senior still survives and keeps nothing, but pirate 2 now falls back on nothing too, so he is as cheap as the others and the senior has a choice of whom to pay. The best proposal is no longer unique, and the later games depend on which one is chosen. The script confirms the tie.
  • n=203 (that is 2G+3). He needs to buy 101 votes. Each costs at least a coin, and he has only G=100. Everyone in the smaller game survives, so nobody votes yes for free. No proposal can stand and he drowns whatever he offers.

The last point is an argument and not something the script runs; the script stops at that count. Beyond it a new effect appears: a pirate who knows he would be the doomed proposer next will vote yes to anything, to save himself, and the votes no longer cost coins. This is the many-pirates case analysed by Ian Stewart in Scientific American in 1999. The page does not reproduce it, and none of it is checked here.

A worked case: the film's five pirates

Each row is what the split gives the pirate, what he gets if it fails (his place in the four-pirate game), and how he votes. The senior's own fallback is drowning.

PirateOfferedIf it failsVoteWhy
198drownsyeshis own proposal; if it fails he drowns
2099no0 is no better than 99
310yesone coin beats 0
401no0 is no better than 1
510yesone coin beats 0

Pirates 3, 5 are the ones paid. Could he keep more? He needs two votes besides his own and every vote costs at least a coin, so he keeps at most 98. Buying pirate 2 instead is no help: his price is one more than the 99 he would otherwise get. Brute force over every split agrees that (98, 0, 1, 0, 1) is the best proposal that stands, and the only one that gives the senior 98.

Generalising

  • More pirates, same gold. The pattern above is the whole answer up to n=2G+1. With G=100 the script follows it up to 200 pirates, where the senior keeps 1 and has paid 99 coins to 99 pirates. The senior's share is G−⌊(n−1)/2⌋ all the way.
  • Another sum of gold. The proof is written for any G. The script runs only G=100, so any other G rests on the proof.
  • A strict majority. With "more than half" in place of "half or more", a two-pirate game has no proposal that stands: the junior would have the whole 100 if the senior drowned, so his price is more than there is, and the senior drowns. Everything above it changes. The script asserts only that the split (100, 0) falls under a strict majority, and does not solve the larger games.
  • Blood before gold. If a pirate would rather see someone drown than get a coin, nobody can be bought for one coin and the answer changes. The film's script records that its source had the order wrong on this point; the film uses live, then gold, then blood.

Checking it

The script scripts/pirates.mjs asserts the following before it writes any number on this page.

  • Backward induction from one pirate to 200 gives the splits the film shows, with every vote on every case, and exactly the votes needed, never one more.
  • Brute force over every split of 100 coins among 2, 3, 4 and 5 pirates (the 4,598,126 splits for five) finds the senior's best passing split to be the one above, and the only split that gives him that much.
  • The pirates paid at n are exactly the ones who get nothing at n−1, the senior keeps the closed form, and nobody else gets more than a coin, for every n up to 200.
  • The closed form with odd positions paid agrees with the induction for every n up to 201. The induction carried two pirates further confirms the unique optimum at 201, the tie at 202, and that 101 votes at 203 outrun the gold.
  • The split counts are enumerated and match (100+n−1n−1).

What is not checked: the proof itself, which the script tests but does not replace; any G other than 100; the argument for n=203 beyond the count of votes; and anything past it.

Where this shows up

  • Backward induction. Solving a game from its last move to its first is the standard method for finite games where everyone sees every move, from small bargaining games to chess endgames.
  • Bargaining. Take-it-or-leave-it offers with a vote are a cousin of the ultimatum game, and alternating-offers bargaining is solved the same way.
  • Many pirates, little gold. Ian Stewart's 1999 article in Scientific American is the best-known account of what happens when the crew is far larger than the treasure.

Try it yourself

1. What does the senior of six pirates propose?

He needs ⌈6/2⌉=3 votes, so two besides his own. In the five-pirate game (98, 0, 1, 0, 1) the pirates who get nothing are the second and the fourth, who are now the third and the fifth. He pays each one coin and keeps 100 minus 2. The script's closed form agrees.

2. Why can the senior of five not keep 100 minus 1?

He needs 3 yes votes, so two besides his own. Each costs at least a coin, so he pays at least 2, and keeps at most 98. Brute force over the 4,598,126 splits finds no better passing one.

3. Why is pirate 2 never the one bought, at five pirates?

If the senior drowns, pirate 2 becomes the proposer of the four-pirate game and gets 99. To beat that you would have to offer him one more, the whole 100, which leaves the senior nothing and still leaves him a vote short. A pirate who would get nothing costs one coin.

4. For 100 coins, where does the simple pattern end?

At n=2G+1, which is 201 pirates. At 202 the senior can still live but must choose whom to pay, and at 203 the votes he must buy, 101, outnumber his coins.