Library · The Fiddler: Solutions · Chapter 2
Can You Maximize the Range?
You roll a number of fair six-sided dice all at once and measure the range of the results: the difference between the largest and the smallest roll. With very many dice the range is almost always . With fewer dice a range of is no longer a sure thing. What is the smallest number of dice for which a range of is more likely than not?
The Fiddler, Zach Wissner-Gross, November 6, 2026(original post)
The official solution appeared in the post of November 13, 2026 and gives dice for the main puzzle, agreeing with the answer below. The Extra Credit half of that post is paywalled, so the value of is my own.
Solution
The range is exactly when the largest roll is and the smallest is , that is, when at least one die shows a and at least one shows a . It is easier to count the failures. A roll fails when there is no or there is no .
With dice, the chance of no is , since each die must avoid one face, and the chance of no is the same. Adding them counts twice the rolls that have neither a nor a , in which every die shows , , or , with chance . Subtracting that overlap once gives the chance of failure, , so Adding a die can only help, since a and a already present stay present, so grows with and we need the first at which it passes . Two values settle it: Seven dice clear the bar by a whisker:
The computation
The check does not use inclusion and exclusion. For each number of dice it lists every one of the equally likely rolls, measures the range directly and counts how often it is , as an exact fraction.
from fractions import Fraction
from itertools import product
def p_range5(d):
"""Exact chance that d dice show a range of 5, by listing every roll."""
good = sum(max(r) - min(r) == 5 for r in product(range(1, 7), repeat=d))
return Fraction(good, 6**d)
for d in range(2, 9):
p = p_range5(d)
verdict = ", more likely than not" if p > Fraction(1, 2) else ""
print(f"{d} dice: {float(p):.4f}{verdict}")
It prints
2 dice: 0.0556
3 dice: 0.1389
4 dice: 0.2330
5 dice: 0.3279
6 dice: 0.4180
7 dice: 0.5004, more likely than not
8 dice: 0.5739, more likely than not
Extra Credit
Now roll dice together, record their total, and repeat this times. For very large the range of the totals is almost always ; for smaller it is not. Find the smallest for which a range of is more likely than not. Write it as with a whole number and , and give to at least four decimal places, and .
Solution
The main puzzle is the miniature of this one. A total of dice lies between and , so the range of the totals is exactly when at least one total is and at least one is . Each extreme can happen in only one way, every die showing or every die showing , so each has chance The repetitions are now the dice, and the extremes are the faces and . The same counting as before, with repetitions in place of dice and , in place of , , gives Again grows with , so we want the point where it crosses .
Here is so small that must be enormous, and the natural scale is the expected number of all-ones totals, . For tiny , , and differs from by about . So up to a relative error of about , which with near is around . Likewise , and to any precision we could ever print, The square has a meaning: the counts of all-ones and all-sixes totals are, in the limit, independent, and each is non-zero with chance .
Setting gives , so The smallest is the first whole number past : To put it in scientific notation, , so , and multiplying by , The rounding up to a whole number and the error of order in the approximation move by a few units at most, far below the th digit, so they cannot touch .
The computation
The check repeats the experiment’s logic with nothing taken on trust: not the value of , and not the formula for .
Compute the exact distribution of the total of dice by expanding . Python’s big integers do this in one power if each coefficient is packed into its own block of binary digits (enough, since no coefficient exceeds ). Read off the number of ways to roll and .
Follow the repetitions as a chain with three states: neither extreme seen yet, one seen, both seen. One repetition moves the chain by a matrix built from the two probabilities in step 1. The chance of a range of after repetitions is the chance of being in the last state, computed by raising the matrix to the power by repeated squaring, in -digit arithmetic so that is not rounded to .
Bisect on for the point where that chance passes .
from mpmath import mp, mpf, matrix, log10, floor
# 1. Exact distribution of the total of 1000 dice
K, BITS = 1000, 2600
packed = sum(1 << (BITS*i) for i in range(1, 7))**K
mask = (1 << BITS) - 1
ways = {s: (packed >> (BITS*s)) & mask for s in range(K, 6*K + 1)}
assert sum(ways.values()) == 6**K
print("ways to roll 1000 / 6000:", ways[K], ways[6*K])
# 2. States: 0 = neither extreme seen, 1 = one seen, 2 = both seen
mp.dps = 1700
p_low = mpf(ways[K]) / 6**K
p_high = mpf(ways[6*K]) / 6**K
step = matrix([[1 - p_low - p_high, p_low + p_high, 0],
[0, 1 - p_low, p_low], # the missing extreme is equally
[0, 0, 1]]) # likely to be either (p_low = p_high)
def chance_full_range(N):
"""Probability that N repetitions reach state 2, by repeated squaring."""
result, power = matrix([[1, 0, 0]]), step
while N:
if N & 1:
result = result * power
power, N = power * power, N >> 1
return result[0, 2]
# 3. The chance only grows with N, so bisect for where it passes 1/2
lo, hi = 1, 6**K * 10 # chance(lo) < 1/2 < chance(hi)
while hi - lo > 6**K // 10**12:
mid = (lo + hi) // 2
if chance_full_range(mid) > 0.5: hi = mid
else: lo = mid
B = int(floor(log10(hi)))
print("N = %s x 10^%d" % (mp.nstr(mpf(hi) / mpf(10)**B, 10), B))
It prints
ways to roll 1000 / 6000: 1 1
N = 1.739522573 x 10^778
matching the boxed value to ten significant figures.