# Can you stick it to the genie?

#### A FiveThirtyEight Riddler puzzle.

By Vamshi Jandhyala in mathematics Riddler

November 19, 2021

## Riddler Express

I have three dice $(d4, d6, d8)$ on my desk that I fiddle with while working, much to the chagrin of my co-workers. For the uninitiated, the $d4$ is a tetrahedron that is equally likely to land on any of its four faces (numbered $1$ through $4$), the $d6$ is a cube that is equally likely to land on any of its six faces (numbered $1$ through $6$), and the $d8$ is an octahedron that is equally likely to land on any of its eight faces (numbered $1$ through $8$).

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

Extra credit: Instead of three dice, I now have six dice: $d4, d6, d8, d10, d12$ and $d20$. 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, d6$ and $d8$ is $\textbf{0.25}$ and the probability of winning with $d4, d6, d8, d10, d12$ and $d20$ is $\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]))
```