Can You Hunt For The Mysterious Numbers?

A FiveThirtyEight Riddler puzzle.

By Vamshi Jandhyala in mathematics Riddler

January 16, 2021

Riddler Express

You’re a contestant on the hit new game show, “You Bet Your Fife.” On the show, a random real number (i.e., decimals are allowed) is chosen between $0$ and $100$. Your job is to guess a value that is less than this randomly chosen number. Your reward for winning is a novelty fife that is valued precisely at your guess. For example, if the number is $75$ and you guess $5$, you’d win a \$5 fife, but if you’d guessed $60$, you’d win a \$60 fife. Meanwhile, a guess of $80$ would win you nothing. What number should you guess to maximize the average value of your fifing winnings?

Solution

Let $X\sim\mathcal{U}[0,100]$ be the random variable representing the random real number that is chosen. Let $Y$ be the random variable representing the fifing winnings.

We have

$$ \begin{equation*} Y = \begin{cases} g, & g < X \
0, & g \geq X \end{cases} \end{equation*} $$

where $g$ is the number you should guess.

Also, $\mathbb{P}[Y = g] = \mathbb{P}[X > g] = \frac{100-g}{100}$.

Therefore, $\mathbb{E}[Y] = g \cdot \mathbb{P}[Y = g] = \frac{g(100-g)}{100}$.

The epectation takes the maximum value when $g = 100 - g = 50$ and maximum value of the expectation is $25$.

Riddler Classic

There are eight three-digit numbers — each belongs in a row of the table below, with one digit per cell. The products of the three digits of each number are shown in the rightmost column. Meanwhile, the products of the digits in the hundreds, tens, and ones places, respectively, are shown in the bottom row.

Table for eight three-digit numbers. The products of the three digits in each number are, respectively, $294$, $216$, $135$, $98$, $112$, $84$, $245$ and $40$. The product of the hundreds digits is $8,890,560$. The product of the tens digit is $156,800$. The product of the ones digit is $55,5664$.

Can you find all eight three-digit numbers and complete the table?

Computational Solution

from z3 import *

class MysteriousNumbersSolver:
    def __init__(self):
        self.X = [[Int("self.X_%s_%s" % (i, j)) for j in range(3)]
                      for i in range(8)]
        self.s = Solver()
        self.s.add([And(0 <= self.X[i][j], self.X[i][j]<= 9) for i in range(8) for j in range(1,3)])
        self.s.add([And(0 <= self.X[i][0], self.X[i][0]<= 9) for i in range(8)])

    def set_constraints(self):   
        self.s.add(self.X[0][0]*self.X[0][1]*self.X[0][2]==294)
        self.s.add(self.X[1][0]*self.X[1][1]*self.X[1][2]==216)
        self.s.add(self.X[2][0]*self.X[2][1]*self.X[2][2]==135)
        self.s.add(self.X[3][0]*self.X[3][1]*self.X[3][2]==98)
        self.s.add(self.X[4][0]*self.X[4][1]*self.X[4][2]==112)
        self.s.add(self.X[5][0]*self.X[5][1]*self.X[5][2]==84)
        self.s.add(self.X[6][0]*self.X[6][1]*self.X[6][2]==245)
        self.s.add(self.X[7][0]*self.X[7][1]*self.X[7][2]==40)
        self.s.add(self.X[0][0]*self.X[1][0]*self.X[2][0]*self.X[3][0]*self.X[4][0]*self.X[5][0]*self.X[6][0]*self.X[7][0]==8890560)
        self.s.add(self.X[0][1]*self.X[1][1]*self.X[2][1]*self.X[3][1]*self.X[4][1]*self.X[5][1]*self.X[6][1]*self.X[7][1]==156800)
        self.s.add(self.X[0][2]*self.X[1][2]*self.X[2][2]*self.X[3][2]*self.X[4][2]*self.X[5][2]*self.X[6][2]*self.X[7][2]==55566)

    def output_solution(self):
        m = self.s.model()
        for i in range(8):
            print(" ".join([str(m.evaluate(self.X[i][j])) for j in range(3)]))

    def solve(self):
        self.set_constraints()
        if self.s.check() == sat:
            self.output_solution()
        else:
            print(self.s)
            print("Failed to solve.")

s = MysteriousNumbersSolver()
s.solve()

Here is the solution

7 7 6
9 8 3
9 5 3
7 2 7 
8 2 7 
7 4 3 
5 7 7 
8 5 1