# Enigmatic Code

Programming Enigma Puzzles

## Tantalizer 463: Benchwork

From New Scientist #1014, 19th August 1976 [link]

The notice in the magistrates retiring room at Bulchester court reads baldly, “Monday: Smith, Brown, Robinson”. These are the surnames of next Monday’s bench, which will, as always, include at least one man and one married woman. All male magistrates at Bulchester happen to be married. These facts are known to all magistrates.

The court being a large and new amalgamation, Smith, Brown and Robinson know nothing about each other. But Smith, on being told the sex of Brown, could deduce the sex of Robinson and the marital status of both. And Robinson, being told only that Smith could do this, could deduce the sex and marital status of Smith and Brown.

What can you deduce about the trio?

[tantalizer463]

### One response to “Tantalizer 463: Benchwork”

1. Jim Randell 17 January 2018 at 8:58 am

This Python program runs in 75ms.

Run: [ @repl.it ]

```from itertools import product
from enigma import filter_unique, unpack, printf

# there are only three possibilities:
#
#   Mm = Male, married
#   Fm = Female, married
#   Fs = Female, single
#
# as (Ms = Male, single) is not possible

# consider possible arrangements
rs = list()
for s in product(('Mm', 'Fm', 'Fs'), repeat=3):
# there must at least one married man, and at least one married woman
if 'Mm' in s and 'Fm' in s:
rs.append(s)

# indices for Smith, Brown, Robinson
(S, B, R) = (0, 1, 2)

# "S being told the sex of B could deduce the sex of R and marital status of B and R"
(rs, _) = filter_unique(rs, unpack(lambda S, B, R: (S, B[0])), unpack(lambda S, B, R: (B, R)))

# "knowing this, R can deduce the sex and marital status of S and B"
(rs, _) = filter_unique(rs, unpack(lambda S, B, R: (R,)), unpack(lambda S, B, R: (S, B)))

# output solutions
for s in rs:
printf("Smith = {s}, Brown = {b}, Robinson = {r}", s=s[S], b=s[B], r=s[R])
```

Solution: Smith is female and single; Brown is female and married; Robinson is male and married.

Of the 12 possible arrangements, the statement about Smith reduces this to 3, and statement about Robinson reduces these 3 possibilities to a single solution.

This site uses Akismet to reduce spam. Learn how your comment data is processed.