After the Math Department’s Magic: the Gathering tournament, the five competitors told
their colleagues how it turned out. But, mathematicians being what they are, each competitor told only a half-truth: that is, one true and one untrue statement. Here’s what they
said:
Allen: Deis came in second. I finished third.
Black: I won the whole thing, and Chang finished second.
Chang: I got third place; poor Black was last.
Deis: I was in second place, and Frayer was fourth.
Frayer: I ended up fourth. Allen was the champion!
What were the true results?
RESULTS:
Allen: finished third.
Black: came in last.
Chang: came in second.
Deis: was the champion!
Frayer: ended up fourth.
Method:
Summarize each fellow's two claims:
Allen is digit 0: D2 A3
Black is digit 1: B1 C2
Chang is digit 2: C3 B5
Deis is digit 3: D2 F4
Frayer is digit 4: F4 A1
Consider 5 digit binary numbers of the form abcde where a=0 means A's first statement was True; or d=1 means D's second statement was True.
There are 2^5 ways the correct claims can be distributed.
Take pairs of mathematicians where there are conflicting statements and eliminate the patterns that correspond to both conflicting statements being true. In the end, there is only one remaining pattern: 11110
Meaning for A,B,C,D the second statement is true
and for F, the first statement is true
0: D2 A3 second
1: B1 C2 second
2: C3 B5 second
3: D2 F4 second
4: F4 A1 first
A3, C2, B5, F4
----------------------
data = [['D2', 'A3'],
['B1', 'C2'],
['C3', 'B5'],
['D2', 'F4'],
['F4', 'A1']]
patterns = [base2base(n,10,2).zfill(5) for n in range(32)]
acceptables = ['1' for i in range(32)]
for index,p in enumerate(patterns):
if p[0] == '0'and p[1] == '1':
acceptables[index] = '0'
if p[1] == '1'and p[2] == '0':
acceptables[index] = '0'
if p[2] == '0'and p[0] == '1':
acceptables[index] = '0'
if p[1] == '0'and p[4] == '1':
acceptables[index] = '0'
if p[0] == '0'and p[3] == '1':
acceptables[index] = '0'
if p[3] == '0'and p[0] == '1':
acceptables[index] = '0'
if p[3] == '0'and p[4] == '0':
acceptables[index] = '0'
if p[3] == '1'and p[4] == '1':
acceptables[index] = '0'
if p[1] == '1'and p[3] == '0':
acceptables[index] = '0'
if p[1] == '0'and p[2] == '1':
acceptables[index] = '0'
for ind, a in enumerate(acceptables):
if a == '1':
print(patterns[ind])
|
Posted by Larry
on 2024-03-09 12:27:52 |