Brain-Teaser 942: By-election candidates
From The Sunday Times, 10th August 1980 [link]
At the Choplogic by-election, all four candidates were good at brainteasers; and it was agreed that each could ask privately, before the announcement, where he himself had come in the poll and where one other candidate had come. Each man chose a different second person, other than himself, to ask about.
When all four had been given truthful answers, the Labour candidate said: “Well, what do we know?”
The Liberal candidate said: “I don’t know who was top of the poll”.
The Communist candidate said: “I don’t know who was top or who was second”.
And the Conservative candidate said: “I’ve forgotten what I was told about one of you three, but even so I can now deduce the place that each of us occupied in the poll”.
What was the information given to the man whose position the Conservative forgot?
[teaser942]



Jim Randell 10:42 am on 26 November 2026 Permalink |
This Python program starts with all possible assignments of positions to the candidates, and other candidates whose position each of the candidates was told.
We can then remove candidates that do not correspond to the given statements.
It runs in 70ms. (Internal runtime is 500µs).
from enigma import (subsets, cproduct, unpack, filter2, is_disjoint, filter_unique, printf) # assign indices for the candidates cands = (Lab, Lib, Com, Con) = (0, 1, 2, 3) # scenarios are given by: ss = list(cproduct([ # the position (1 - 4) of each candidate subsets([1, 2, 3, 4], size=len, select='P'), # the index of the other candidate they are told subsets(cands, size=len, select='D'), ])) # 1. the Lib candidate does not know who was 1st f1 = unpack(lambda pos, oth: 1 not in {pos[Lib], pos[oth[Lib]]}) ss = filter2(f1, ss).true # 2. the Com candidate does not know who was 1st or 2nd f2 = unpack(lambda pos, oth: is_disjoint([{1, 2}, {pos[Com], pos[oth[Com]]}])) ss = filter2(f2, ss).true # 3. the Con candidate can now deduce all positions knowing just his own position f3 = unpack(lambda pos, oth: pos[Con]) g3 = unpack(lambda pos, oth: pos) ss = filter_unique(ss, f3, g3).unique # output solutions i2c = ["Lab", "Lib", "Com", "Con"] for (pos, oth) in ss: for (i, c) in enumerate(i2c): j = oth[i] printf("{c}: pos {p}; told {j} = pos {q}", p=pos[i], j=i2c[j], q=pos[j]) printf()Solution: The information was: Labour = 1st, Liberal = 2nd.
One scenario is:
There is a second scenario where Conservative came 3rd and the Communist came 4th, but everything else is the same.
So, the Conservative forgot he was told the position of Labour (even though he was told Labour had come 1st), and the Labour candidate had been told his own position (Labour = 1st) and the position of the Liberal candidate (Liberal = 2nd).
LikeLike