A board game: your piece can only leave home when you roll a six. Write chance_first_on(roll, p): the chance that your first six comes on roll number roll (1 is the first roll), when each roll succeeds with chance p. The puzzle also plays a quick version with a coin (heads lets you out), a house rule where a five or a six will do, and a long version that needs a 20 on a 20-sided die.
216 players each roll a die, round after round; a six lets a piece out of home. Each column is a roll number, and the players stack in the column of the roll that got them out. The obvious guess, 1 in 6 on every roll, runs out of players by roll 6. The goal is the shape it ends on. Once it has played, click a column.
chance_first_on(roll, p)| roll | which roll it is, 1 for the first roll, 2 for the second, ... | e.g. 1 |
| p | the chance that one roll succeeds, e.g. 1/6 for a six on a die | e.g. 0.167 |
| returns | the chance that the first success comes on exactly this roll | |