# Can You Cross Like A Boss?

A FiveThirtyEight Riddler puzzle.
mathematics
Riddler
Published

February 13, 2021

## Riddler Express

This time around, there are six 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. Can you find all six three-digit numbers and complete the table?

## Computational Solution

``````from z3 import *

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

def set_constraints(self):

def output_solution(self):
m = self.s.model()
for i in range(6):
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.")

``````7 6 5