2 min read

Can you stick it to the genie?

Table of Contents

Riddler Express

I have three dice (d4,d6,d8)(d4, d6, d8) on my desk that I fiddle with while working, much to the chagrin of my co-workers. For the uninitiated, the d4d4 is a tetrahedron that is equally likely to land on any of its four faces (numbered 11 through 44), the d6d6 is a cube that is equally likely to land on any of its six faces (numbered 11 through 66), and the d8d8 is an octahedron that is equally likely to land on any of its eight faces (numbered 11 through 88).

I like to play a game in which I roll all three dice in “numerical” order: d4d4, then d6d6 and then d8d8. I win this game when the three rolls form a strictly increasing sequence (such as 2472-4-7, but not 2442-4-4). What is my probability of winning?

Extra credit: Instead of three dice, I now have six dice: d4,d6,d8,d10,d12d4, d6, d8, d10, d12 and d20d20. If I roll all six dice in “numerical” order, what is the probability I’ll get a strictly increasing sequence?

Computational solution

From the simulation below, we see that the probability of the winning with d4,d6d4, d6 and d8d8 is 0.25\textbf{0.25} and the probability of winning with d4,d6,d8,d10,d12d4, d6, d8, d10, d12 and d20d20 is 0.0118\textbf{0.0118}.

from random import choice
def prob(dice_num_faces, runs=10000000):
    dice = {n:list(range(1, n+1)) for n in dice_num_faces}
    cnt_succ = 0
    for _ in range(runs):
        roll = [choice(dice[d]) for d in sorted(dice.keys())]
        cnt_succ += all(i < j for i, j in zip(roll, roll[1:]))
    return cnt_succ/runs

print(prob([4,6,8]))
print(prob([4,6,8,10,12,20]))