Dice game: when to stop rolling

You roll a die and you're paid what it shows. If you don't like the number, you can throw it away and roll again, up to a set number of rolls, but once you reroll the old number is gone. Pick the faces, the rolls and a cost per reroll if you want one, and you'll see when to stop and what the game is worth to you.

Rolls left after this oneKeep the roll if it is at leastValue of the game from here

How it works

Start from the last roll. If you've only one roll left, you take what comes, and on a normal die that's worth 3.5 on average. With two rolls left, you keep the first one only if it beats 3.5, so you keep a 4, 5 or 6 and reroll anything else. That makes the game worth (4 + 5 + 6)/6 + (3/6)(3.5), which is 4.25.

Every extra roll is the same step again. You keep the roll if it beats what the game is worth with one roll fewer (less the reroll cost, if you set one). With three rolls you'd keep only a 5 or a 6 first time, and the game comes to 14/3, just under 4.67. I've seen candidates get the 3.5 and then stall, so I'd practise saying the backward step out loud.

More puzzles of this kind, with worked answers: quant interview brainteasers