### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

- article (11)
- enigma (1,383)
- misc (4)
- project euler (2)
- puzzle (90)
- puzzle# (56)
- site news (61)
- tantalizer (101)
- teaser (7)
- today (1)

### Site Stats

- 240,810 hits

Programming Enigma Puzzles

1 April 2020

Posted by on **From New Scientist #958, 17th July 1975** [link]

As a tailpiece to his psychology test Professor Plato invited each of the five candidates to compare the likely performance of three of the others. He got these five pairs of answers:

1. Bill will do better than Edward. Charles will do better than Bill.

2. Debbie will do better than Charles. Arthur will do better than Debbie.

3. Edward will do better than Arthur. Charles will do better than Edward.

4. Bill will do better than Edward. Debbie will do better than Bill.

5. Charles will do better than Bill. Arthur will do better than Charles.Pleasingly, the winner was wholly right, the boy who came bottom wholly wrong and the others each made exactly one correct prediction. (There were no ties).

What is the order of merit on the professor’s test?

[tantalizer408]

%d bloggers like this:

Assuming that Debbie is not a boy gives us a unique solution.

This Python program runs in 94ms.

Run:[ @repl.it ]Solution:1st: Debbie; 2nd: Arthur; 3rd: Edward; 4th: Charles; 5th: Bill.There are only 2 ways the predictions can be assigned to the students. And only 2 ways that students can be assigned positions that give the required number of correct predictions. But one of those ways has Debbie placed 5th and we are told that a boy came bottom.

Somewhat eccentric, I know, but here is a set of instructions for an excel spreadsheet.

First off using some help from stack overflow on the Internet, we populate cells with the permutations of the numbers 12345. There is no function to do this in Excel.

Open a blank worksheet and paste the following formula into cell A1. (I included line breaks for readability.)

`= IF(ROW()=FACT(ROW($A$2:$A$10)))+0)+1),`

IF(COLUMN()=(SUMPRODUCT(((ROW()-1)>=FACT(ROW($A$2:$A$10)))+0)+2),1,COLUMN()+1))))

Simply drag this formula over N columns and then down N! rows in order to generate a full permutation table of order N.

Here N is 5. Next set up a small table of three rows and five columns to encode logical statements, for all the 5 pairs of statements. Place the XOR() in column 1, the AND() in column 2, and the NOT( OR()) in column 3, acting on one of the 120 possible rankings. At the foot of the column, COUNT the number of TRUE statements in the column. In another cell write the IF statement that if the COUNT in column 1 =3, COUNT in column 2 =1, COUNT in column 3 =1: write “solution” in the cell.

Repeat for all the permutations.

Finally check that in the solution, the student ranked 5 is a boy.