Books · The Fiddler: Solutions
Chapter 27
Can You Take the Heat?
On the show Hot Ones you face hot sauces ranked to . Rather than buy all ten, you buy a few sauce numbers and combine sauces (adding their numbers, each used at most once) to hit any value you are missing. With the set you can already make every value from to . Counting that set, how many sets of four sauce numbers let you generate all of through ?
The Fiddler, Zach Wissner-Gross, November 28, 2025(original post)
Solution
A set works when every target is a subset sum. To make you need sauce ; to make you then need sauce (nothing else is small enough). Sorting the four numbers , the subset sums fill contiguously as long as each new number is at most one more than the running total, and the four must total at least . So , giving , and with . Counting: That is sets.
The computation
Test every four-sauce set directly: form all its subset sums and check that through are all reachable. Eight sets pass.
import itertools as it
def covers(S, top):
sums = {0}
for x in S: sums |= {s + x for s in sums}
return all(t in sums for t in range(1, top + 1))
print(sum(covers(S, 10) for S in it.combinations(range(1, 11), 4))) # 8
Extra Credit
For “Hotter Ones,” the sauces run to . Let be the fewest sauces needed to generate every value from to . For how many sets of sauce numbers is it possible?
Solution
With sauces there are only nonempty subset sums, so covering values needs , forcing ; and shows suffices. Counting all -element subsets of whose subset sums cover to (each must start at , grow contiguously until the running total reaches , after which the remaining sauces are free) gives (The source’s count is behind its paywall; this is my own enumeration.)
The computation
Count valid -sets by the contiguous-coverage rule: choose sauces in increasing order, each at most one past the running total (so subset sums stay gap-free), until coverage reaches , after which any larger sauces complete the set.
from math import comb
from functools import lru_cache
N = 7
@lru_cache(None)
def cnt(k, last, reach): # k chosen, last value used, coverage [0, reach]
if k == N: return 1 if reach >= 100 else 0
if reach >= 100: return comb(100 - last, N - k) # remaining sauces are free
return sum(cnt(k + 1, v, reach + v) for v in range(last + 1, min(100, reach + 1) + 1))
print(cnt(1, 1, 1)) # 1014 (every set must start with sauce 1)