Four Numbers from Six Dice
The July 2026 MoMath Monthly Mindbender: roll six dice and ask for exactly four distinct faces. Choosing the four faces and surjecting the dice onto them gives 15 x 1560 = 23400 rolls out of 46656, a probability of 325/648. That is 1/2 + 1/648, just over one half, and the same count shows three and five distinct faces are exactly equally likely.
Problem
If you roll six dice, you could get the same number on every die, or, in contrast, all different numbers. What is the probability of getting exactly four distinct numbers?
The puzzle suggests making a guess first, then doing the calculation, on the grounds that the answer may surprise you.
Credit: MoMath Monthly Mindbenders, July 2026.
Counting the rolls
Six dice, each showing one of six faces, give equally likely rolls. Count the ones in which exactly four distinct faces appear.
Such a roll is built by two independent choices. First decide which four of the six faces show up, in ways. Then decide which die shows which of those four faces, and here the condition bites: each of the four chosen faces must appear at least once, or the roll would have fewer than four distinct values. So the assignment of the six dice to the four faces must be a surjection.
The number of surjections from a set of six onto a set of four is counted by inclusion and exclusion on the faces that fail to appear:
Equivalently , writing for the Stirling number of the second kind: partition the six dice into four unlabelled nonempty blocks in ways, then attach the four faces to the blocks in ways.
Multiplying the two choices,
and therefore
That is the surprise the puzzle advertises. Exactly four distinct numbers is more likely than every other outcome put together, and yet only barely, because
The count clears half by a single part in . Most guesses land well below a half, on the reasoning that four is one particular value out of six possibilities, which quietly assumes the six values are anywhere near equally likely. They are not.
The rest of the distribution
The same argument with in place of four gives the whole picture, since choices of face set combine with surjections:
| distinct faces | 1 | 2 | 3 | 4 | 5 | 6 |
|---|---|---|---|---|---|---|
| rolls | 6 | 930 | 10800 | 23400 | 10800 | 720 |
| probability |
The six counts sum to , which is the arithmetic check worth doing.
Two features stand out. The distribution is sharply peaked at four, which is why the answer beats a half at all: the neighbouring values and together carry only about per cent, and the extremes are negligible. All six dice matching happens once in rolls, and all six differing only once in .
The second is a coincidence that looks like a symmetry and is not. Three distinct faces and five distinct faces have exactly the same probability, , since
The two routes to are quite different, a small face set filled generously against a large face set filled sparsely, and the equality does not survive a change in the number of dice. Roll seven dice and the counts for three and five distinct faces are and , nothing alike. It is a numerical accident of the case where the number of dice equals the number of faces.
How fine the margin is
A margin of is small enough to be worth a second look, because it is the difference between the answer and a coin flip. Suppose you tried to establish the excess experimentally. Estimating a probability near from throws carries a standard error of about , so to see a gap of at all you need
The number of throws needed is, pleasingly, the square of the denominator. Rolling six dice four hundred thousand times, at a generous ten seconds a throw, is about seven weeks of continuous rolling. The exact count takes a line of arithmetic, and this is the ordinary situation in combinatorics rather than a curiosity: counting settles in a moment what sampling would need a lifetime to resolve.
Checking it
The formula is short enough to be worth checking against something dumber, so the listing enumerates all rolls and counts distinct faces directly, with no combinatorics at all. It then rebuilds the same table from the closed form and compares, and finally throws real dice at it.
from fractions import Fraction
from itertools import product
from math import comb, factorial
import numpy as np
counts = [0]*7 # brute force: every one of the 6^6 rolls
for roll in product(range(6), repeat=6):
counts[len(set(roll))] += 1
print("counts :", counts[1:], " total", sum(counts), "= 6^6 =", 6**6)
print("probs :", [str(Fraction(c, 6**6)) for c in counts[1:]])
surj = lambda n, k: sum((-1)**j * comb(k, j) * (k-j)**n for j in range(k+1))
formula = [comb(6, k) * surj(6, k) for k in range(1, 7)]
print("closed form :", formula, " matches:", formula == counts[1:])
p4 = Fraction(counts[4], 6**6)
print(f"P(four distinct) = {p4} = {float(p4):.8f}")
print(f" = 1/2 + {p4 - Fraction(1,2)}; 4! S(6,4) = {factorial(4)*65}")
print(f" P(3) = P(5)? {counts[3]} vs {counts[5]}")
print(f" seven dice, three vs five: "
f"{comb(7,3)*surj(7,3)} vs {comb(7,5)*surj(7,5)}")
rng = np.random.default_rng(20260716) # and now actually roll them
d = np.sort(rng.integers(0, 6, (5_000_000, 6)), axis=1)
nd = (d[:, 1:] != d[:, :-1]).sum(1) + 1
print(f"Monte Carlo: P(4) = {(nd == 4).mean():.6f}")
# counts : [6, 930, 10800, 23400, 10800, 720] total 46656 = 6^6 = 46656
# probs : ['1/7776', '155/7776', '25/108', '325/648', '25/108', '5/324']
# closed form : [6, 930, 10800, 23400, 10800, 720] matches: True
# P(four distinct) = 325/648 = 0.50154321
# = 1/2 + 1/648; 4! S(6,4) = 1560
# P(3) = P(5)? 10800 vs 10800
# seven dice, three vs five: 63210 vs 352800
# Monte Carlo: P(4) = 0.501894
Five million throws put the estimate at against the exact . The discrepancy is , and the standard error at that sample size is , so the simulation is doing what it should. It also shows the trouble with settling this by experiment: even five million throws leave the estimate wobbling by more than half the quantity being measured.