Chapter 212
In Space, No One Can Hear Your 3D Printer Die
Riddler Express
I multiplied together some of the integers from to . I got a big number in return:
What is the missing digit?
The Riddler, FiveThirtyEight, January 11, 2019(original post)
Solution
The missing digit is recovered by casting out nines, provided the product is divisible by . Show that first, then read off the digit.
Why the product must be divisible by . The product is taken over some subset of . The published number has digits, of which the rightmost are trailing zeros. The number is therefore enormous: any subset whose product reaches this size must include nearly every available factor, in particular more than one multiple of . To see this concretely, the largest product over any subset of that includes exactly one multiple of is bounded above by where is the largest single multiple of in the range and the second factor is the product of the integers in coprime to . A direct calculation (or even a crude logarithmic estimate) shows this bound is many orders of magnitude below the puzzle’s -digit number. The puzzle’s product therefore contains at least two distinct multiples of , hence two factors of , hence a factor of .
Casting out nines. A number is divisible by if and only if the sum of its digits is divisible by . Let be the missing digit. Summing the known digits of the number with in the masked slot gives A direct sum of the known digits (the missing slot replaced by for bookkeeping) yields , and , so . Hence The only single digit in congruent to is itself (; would not be a digit).
The computation
Encode the problem directly: take the number as given, with the missing digit marked, and find the digit that makes the digit sum a multiple of . No reliance on the derivation: the script just sweeps and reports the unique value that works.
Write out the digit string with the missing slot.
For each candidate , replace the slot with and test divisibility by via the digit sum.
Report the unique that passes.
groups = (
"530,131,801,762,787,739,802,889,792,754,109,70?,139,358,"
"547,710,066,257,652,050,346,294,484,433,323,974,747,960,"
"297,803,292,989,236,183,040,000,000,000"
).split(",")
number_with_slot = "".join(groups)
candidates = [d for d in range(10)
if sum(int(c) for c in number_with_slot.replace("?", str(d)))
% 9 == 0]
print("Digits making the number divisible by 9:", candidates)
The script prints the single-element list , matching the boxed answer.
Riddler Classic
Congratulations, astronaut! You have been selected for the first manned mission to Mars and will spend five Earth-years on the surface, that is Earth-days (no leap years). Exactly one vital piece of equipment will break each day. You and the crew bring three D printers to print replacement parts. Each printer is from a different country, so parts from one printer are incompatible with the others (no scavenging). When a printer itself breaks, one of the other printers must print its replacement part. Parts print effectively instantly, but any given printer can print at most one piece per day. In addition to the daily vital-equipment break, the three printers have independent daily break probabilities , , and . If you cannot print a replacement for any piece of vital equipment, you die. What is the probability you make it home alive?
The Riddler, FiveThirtyEight, January 11, 2019(original post)
Solution
Reduce the daily survival condition first; then the -day question becomes a single Bernoulli product.
The daily survival condition. Let , , be the three printers with daily break probabilities , , , and let be the number of them that break on a given day. The astronaut also needs to print one replacement for the vital equipment that day. Print demands and capacities, considered for the day’s schedule:
: no printer is broken; any printer can print the vital part. Survives.
: two working printers remain; use one of them to print the broken printer’s part (it is then operational), and the other (or the just-repaired one) to print the vital part. Survives.
: one working printer remains. Suppose and both break and is alive. Order the print jobs within the day: prints ’s part (so is now working), then prints ’s part (so is now working), then prints the vital-equipment part. Each printer does at most one job, so the one-piece-per-printer-per-day budget is met. Survives.
: all three printers break on the same day. No printer is alive to print anyone’s first repair. The vital part cannot be made. Dies.
So the day is survived if and only if at least one printer is working at the start of the day, which is the same as saying not all three broke. (Printers that broke are restored by day’s end whenever a chain of repairs is possible, which the case analysis just showed it is whenever . The next morning therefore starts with all three printers operational again.) The daily failure probability is
Surviving days. The day-to-day failure events are independent because, after any successful day, all three printers are operational, and the next day’s breakages are drawn from the same independent triple. Hence
The computation
Simulate the calendar directly: each day, draw three independent break indicators; if all three break, the mission ends. Otherwise the day is survived and the printers reset. Compare the empirical survival rate over many trials to the closed form.
For each trial, walk through days.
On each day, draw three independent Bernoulli break flags with probabilities , , .
If all three break, the trial is a death; otherwise continue.
Report the empirical survival probability and compare to .
import random
def simulate(trials=200_000, days=1825, seed=0):
rng = random.Random(seed)
ps = (0.10, 0.075, 0.05)
survived = 0
for _ in range(trials):
alive = True
for _day in range(days):
if all(rng.random() < p for p in ps):
alive = False
break
if alive:
survived += 1
return survived / trials
q = 0.10 * 0.075 * 0.05
closed = (1 - q) ** 1825
print(f"closed form = {closed:.4f}")
print(f"simulated = {simulate():.4f}")
The script prints and (within Monte-Carlo noise of at trials), matching the boxed answer.