Skip to content
Vamshi Jandhyala

Books · The Riddler

Chapter 251

Can You Solve A Particularly Prismatic Puzzle?

Riddler Express

In the 1984 World Championship (first to six wins), Karpov led Kasparov five wins to three when the match was halted. Taking each game independently with Karpov winning 5/485/48, Kasparov 3/483/48, and a draw 40/4840/48, what was Kasparov’s chance of eventually winning the match had it continued?

The Riddler, FiveThirtyEight, December 13, 2019(original post)

Solution

Draws are a red herring: they lengthen the match but never change who wins. Strip them out and condition on games that have a winner. Among decisive games, Karpov takes a share 55+3=58\tfrac{5}{5+3} = \tfrac58 and Kasparov 38\tfrac38.

Kasparov trailed five wins to three, and the match goes to the first to six wins. So Kasparov needed three more decisive games to fall his way before even one fell to Karpov, since a single Karpov win would bring Karpov to six and end it. He had to win the next three decisive games outright: (38)3=275125.3%.\left(\frac38\right)^3 = \frac{27}{512} \approx \boxed{5.3\%}. Long odds, which is part of why the abandonment was so controversial.

The computation

Encode the match as a race over decisive games (and, separately, simulate the full game-by-game match including draws) to confirm Kasparov reaches six wins first only about 5.3%5.3\% of the time.

import random
# direct: Kasparov must win the next 3 decisive games (each 3/8)
print("direct:", (3 / 8) ** 3)                       # 0.052734...

# simulate the full match with draws (Karpov 5, Kasparov 3 wins already)
rng = random.Random(0); T = 2_000_000; kasp = 0
for _ in range(T):
    a, b = 5, 3                                       # Karpov, Kasparov wins so far
    while a < 6 and b < 6:
        r = rng.random()
        if r < 5 / 48: a += 1
        elif r < 8 / 48: b += 1                        # else draw, no change
    kasp += (b == 6)
print("simulated:", kasp / T)
# direct: 0.052734375
# simulated: 0.0526

Riddler Classic

For how many rectangular prisms (cuboids) with whole-number side lengths does the volume (in cubic units) equal the surface area (in square units)? One is 6×6×66 \times 6 \times 6. How many are there in total?

The Riddler, FiveThirtyEight, December 13, 2019(original post)

Solution

We need whole numbers abca \ge b \ge c with abc=2(ab+bc+ca).abc = 2(ab + bc + ca). Divide by abcabc: 1=2 ⁣(1c+1b+1a)1 = 2\!\left(\tfrac1c + \tfrac1b + \tfrac1a\right), so 1a+1b+1c=12\tfrac1a + \tfrac1b + \tfrac1c = \tfrac12. Since cc is the smallest, 3c12\tfrac3c \ge \tfrac12, giving c6c \le 6; and 1c<12\tfrac1c < \tfrac12 forces c3c \ge 3. So c{3,4,5,6}c \in \{3, 4, 5, 6\}, and for each cc the equation in a,ba, b has only finitely many whole-number solutions. Enumerating them yields exactly 10\boxed{10} cuboids: (3,7,42), (3,8,24), (3,9,18), (3,10,15), (3,12,12),(4,5,20), (4,6,12), (4,8,8), (5,5,10), (6,6,6).\begin{gathered} (3,7,42),\ (3,8,24),\ (3,9,18),\ (3,10,15),\ (3,12,12),\\ (4,5,20),\ (4,6,12),\ (4,8,8),\ (5,5,10),\ (6,6,6). \end{gathered} The largest side that ever appears is 4242, and despite searching far beyond it, there are no others.

The computation

Encode the equation and search. The bound 1a+1b+1c=12\tfrac1a + \tfrac1b + \tfrac1c = \tfrac12 caps c6c \le 6 and then bb, so a finite scan finds them all.

sols = []
for c in range(3, 7):
    for b in range(c, 2 * c * 6 + 1):
        for a in range(b, 4 * b * c + 1):
            if a * b * c == 2 * (a * b + b * c + c * a):
                sols.append((c, b, a))
print(len(sols), "cuboids:", sols)
# 10 cuboids: [(3, 7, 42), (3, 8, 24), (3, 9, 18), (3, 10, 15), (3, 12, 12),
#  (4, 5, 20), (4, 6, 12), (4, 8, 8), (5, 5, 10), (6, 6, 6)]

The scan returns exactly ten cuboids, the complete list.