Skip to content
Vamshi Jandhyala

Books · The Riddler

Chapter 103

Can You Solve This Napoleonic Puzzle?

Short but deadly. Complete the series: 10, 11, 12, 13, 14, 15, 16, 17, 21, 23, 30, 33, 10,\ 11,\ 12,\ 13,\ 14,\ 15,\ 16,\ 17,\ 21,\ 23,\ 30,\ 33,\ \ldots That is the whole puzzle.

The Riddler, FiveThirtyEight (Andy Laursen)(original post)

Solution

The trap is reading the entries as ordinary base-ten numbers. They are not numbers at all but digit-strings, and every one of them spells the same value, fifteen, in a different base. The list is just 1515 written in base 1515, then base 1414, then 1313, and so on downward.

The first entry makes the pattern visible. In base 1515 the value fifteen is one fifteen and no units, written 10. Drop the base by one to 1414: now fifteen is one fourteen and one unit, 11. Each step down adds one to the units digit, 15=18+7    17 (base 8),15 = 1\cdot 8 + 7 \;\Rightarrow\; \texttt{17 (base 8)}, until the units would overflow. At base 77 a second place is forced: 15=27+1=2115 = 2\cdot 7 + 1 = \texttt{21}, then 15=26+3=2315 = 2\cdot 6 + 3 = \texttt{23}, 15=35+0=3015 = 3\cdot 5 + 0 = \texttt{30}, and 15=34+3=3315 = 3\cdot 4 + 3 = \texttt{33} in base 44. The printed list stops there, so the next two terms are fifteen in base 33 and base 22: 15=19+23+0=120,15=8+4+2+1=1111.15 = 1\cdot 9 + 2\cdot 3 + 0 = \texttt{120}, \qquad 15 = 8 + 4 + 2 + 1 = \texttt{1111}. The missing terms are 120 and 1111.\boxed{120 \text{ and } 1111}. The deadly brevity is the point: with no operations to reverse-engineer, the only foothold is to suspect that the digits are speaking in shifting bases.

The computation

Write fifteen out in each base from 1515 down to 22 and read off the sequence; the two terms past base 44 are the answer.

def in_base(n, b):
    digits = []
    while n:
        digits.append(str(n % b))
        n //= b
    return ''.join(reversed(digits)) or '0'

print([in_base(15, b) for b in range(15, 1, -1)])
# ['10', '11', '12', '13', '14', '15', '16', '17',
#  '21', '23', '30', '33', '120', '1111']