From The Sunday Times, 10th August 1975 [link]
A farmer grows apples in an orchard divided into plots —three to the East and three to the West of a central path. The apples are of two types — for eating (Cox, Laxton, Pearmain) and for cider making (Tremlitt, Coppin, Kingston).
Adjacent plots contain apples of different basic type. The apples are of six colours (red, green, russet, golden, orange, yellow) and of six tastes (sweet, sour, acid, tart, pleasant, bitter).
They ripen at different times, either early or late in July, August and September. Those ripening in early or late September are in plots directly opposite. Those South of Pearmain do not ripen in August. Tart are directly West of the acid variety, which ripens in early August. Yellow apples and those maturing in late September are adjacent. Yellow and orange are of the same type. Orange are North of pleasant and also North of Pearmain. Kingstons are adjacent to golden. Green is South of bitter.
Cox ripen in early July, and Laxtons ripen early in a different month. Tremlitts are red, and Kingstons mature after Coppins, which are not sour.
If cider apples taste unpleasant, what are the characteristics of the apples in North East plot? (Name, colour, taste, ripens).
This puzzle is included in the book The Sunday Times Book of Brain-Teasers: Book 2 (1981).
I think the puzzle as published in The Sunday Times and in the book is open to interpretation, and my first attempt using a reasonable interpretation gave two solutions (neither of which are the published solution). After examining the given solution in the book I think the following wording is clearer:
A farmer grows apples in an orchard divided into plots — three to the East and three to the West of a central track. Adjacent plots are separated by a shared fence. The apples are of two basic types — for eating (Cox, Laxton, Pearmain) and for cider making (Tremlitt, Coppin, Kingston).
Neighbouring plots contain apples of different basic type. The apples are of six colours (red, green, russet, golden, orange, yellow) and of six tastes (sweet, sour, acid, tart, pleasant, bitter).
They ripen at different times, either early or late in July, August and September. Those ripening in early or late September are in plots directly opposite each other. Those directly South of Pearmain do not ripen in August. Tart are directly West of the acid variety, which ripens in early August. Yellow apples and those maturing in late September are in adjacent plots. Yellow and orange are of the same basic type. Orange are directly North of Permain, which are pleasant. Kingstons and golden are in adjacent plots. Green is directly South of bitter.
Cox ripen in early July, and Laxtons ripen early in a different month. Tremlitts are red, and Kingstons mature after Coppins, which are not sour.
If cider apples are neither pleasant nor sweet, what are the characteristics of the apples in North-East plot?
[teaser734]
Jim Randell 11:18 am on 1 October 2024 Permalink |
Here is a solution using the [[
SubstitutedExpression]] solver from the enigma.py library.It runs in 90ms. (Internal runtime of the generated program is 12ms).
#! python3 -m enigma -rr SubstitutedExpression # suppose the first three horses are: A, B, C (ordered by number) # and the four non-runners are: W, X, Y, Z (ordered by number) --base=43 --digits="1-42" --distinct="ABCWXYZ" --invalid="24|28,ABCWXYZ" # A, B, C are ordered by number "A < B" "B < C" # and form an arithmetic progression (common diff = D) "B - A = D" "C - B = D" # one of them is 15 "15 in {A, B, C}" # W, X, Y, Z are ordered by number "W < X" "X < Y" "Y < Z" # and form an arithmetic progression (common diff = D) "X - W = D" "Y - X = D" "Z - Y = D" # equal sums "W + Z == A + B + C" --template=""Solution: The 4 non-runners were: 12, 19, 26, 33.
Which forms an arithmetic progression with common difference of 7.
The horses in the first 3 places were: 8, 15, 22.
Which also form an arithmetic progression with a common difference of 7.
The sum of the numbers of the first 3 horses is 8 + 15 + 22 = 45, the same as the sum of the highest and lowest numbered non-runners 12 + 33 = 45.
LikeLike
Ruud 4:36 pm on 1 October 2024 Permalink |
import itertools for non_runners in itertools.combinations(set(range(1, 43)) - {15, 24, 28}, 4): if (diff := non_runners[1] - non_runners[0]) == non_runners[2] - non_runners[1] == non_runners[2] - non_runners[1] == non_runners[3] - non_runners[2]: runners123 = set(range(1, 43)) - set(non_runners) - {24, 28} for first in runners123: second = first + diff third = second + diff if second in runners123 and third in runners123 and 15 in {first, second, third} and first + second + third == non_runners[0] + non_runners[3]: print(f"{non_runners=} {first=} {second=} {third=}"), which prints:
LikeLike
GeoffR 7:23 pm on 1 October 2024 Permalink |
% A Solution in MiniZinc include "globals.mzn"; var 1..42:NR1; var 1..42:NR2; var 1..42:NR3; var 1..42:NR4; var 1..42:W1; var 1..42:W2; var 1..42:W3; constraint all_different ([NR1, NR2, NR3, NR4, W1, W2, W3]); constraint W2 - W1 == W3 - W2; constraint NR1 < NR2 /\ NR2 < NR3 /\ NR3 < NR4; constraint NR2 - NR1 == NR3 - NR2 /\ NR3 - NR2 == NR4 - NR3; constraint NR2 - NR1 == W2 - W1; constraint NR1 + NR4 == W1 + W2 + W3; constraint sum ([W1 == 15, W2 == 15, W3 == 15]) == 1; var set of int: horses = {NR1, NR2, NR3, NR4, W1, W2, W3}; constraint card ({24, 28} intersect horses) == 0; solve satisfy; output ["Numbers of non-runners = " ++ show([NR1, NR2, NR3, NR4]) ++ "\nWinning numbers = " ++ show([W1, W2, W3]) ]; % Numbers of non-runners = [12, 19, 26, 33] % Winning numbers = [8, 15, 22] % ---------- % ==========LikeLike