Lesson goal: Three dice small straight

Previous: Dice streaks probability | Home | Next: Introduction: Make a flashing animation

In the 1977 MAA Annual High School Mathematics Examination (Problem #17), contestants answered this dice probability question:

"Three fair dice are tossed (all faces have the same probability of coming up). What is the probability that the three numbers turned up can be arranged to form an arithmetic progression with common difference one? (A) 1/6 (B) 1/9 (C) 1/27 (D) 1/54 (E) 7/108."

When three standard 6-sided dice are rolled, there are $6 \times 6 \times 6 = 216$ equally likely outcomes.

For the three numbers to form an arithmetic progression with common difference 1, they must be three consecutive integers: $$\{1, 2, 3\}, \quad \{2, 3, 4\}, \quad \{3, 4, 5\}, \quad \{4, 5, 6\}$$ Notice there are exactly 4 such sets.

Because the dice are distinct (e.g., Red, Green, Blue), any set of 3 different numbers can appear in $3! = 3 \times 2 \times 1 = 6$ different orders: $$\text{Favorable outcomes} = 4 \text{ sets} \times 6 \text{ permutations} = 24$$ Therefore, the probability is: $$P = \frac{24}{216} = \frac{1}{9} \approx \mathbf{0.1111}$$

In this lesson, we write a triple loop in Lua to generate all 216 rolls, sort the values, and count how many produce consecutive sequences!

Now you try. Replace ???? with 1 and run the code to verify that exactly 24 out of 216 rolls form consecutive numbers (1/9).

Type your code here:


See your results here: