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 8:11 am on 29 October 2024 Permalink |
I assumed that the rail fare does not have a trailing zero, so that the room rate does not have a leading zero.
This Python program finds the first solution where the rail fare and room rate are less than £100.
It runs in 80ms. (Internal runtime is 188µs).
from enigma import (irange, nrev, div, printf) # consider possible rail fares for F in irange(1, 99): # disallow trailing zeros if F % 10 == 0: continue # the room rate is the reverse of this R = nrev(F) # cost for 30 nights and 33 nights t30 = 4*F + 30*R t33 = 4*F + 33*R # t33 is a k per cent increase on t30 r = div(100 * t33, t30) if r is None: continue printf("F={F} R={R} r={r}%") breakSolution: The cost of the room was £ 54 per night.
And so the rail fares were £ 45 per person (single).
The cost for 30 days is:
And the cost for 33 days:
And we have:
So the increase is 9%.
There are larger solutions, for example:
But the room is described as “inexpensive”, so only the first of these is a viable solution.
However, they all involve a 9% increase.
LikeLike
GeoffR 12:34 pm on 29 October 2024 Permalink |
LikeLike
Ruud 4:15 am on 30 October 2024 Permalink |
from istr import istr istr.repr_mode("int") for train in istr(range(10, 100)): room = train[::-1] if room[0] != 0: total30 = int(train * 4 + room * 30) total33 = int(train * 4 + room * 33) increase = ((total33 - total30) / total30) * 100 if increase % 1 == 0: print(f"{train=} {room=} {total30=} {total33=} {increase=:.0f}%")LikeLike
Frits 5:43 am on 3 November 2024 Permalink |
Objective was to use fewer iterations.
from fractions import Fraction as RF # fare = 10 * f + g, room cost = 10 * g + f # t30 = 4*F + 30*R = 70*f + 304*g # t33 = 4*F + 33*R = 73*f + 334*g # 100 + p = 100 * (73*f + 334*g) / (70*f + 304*g) # integer percentages less than 10 for p in range(9, 0, -1): # (7300*f + 33400*g) - (100 + p) * (70*f + 304*g) = 0 # ((300 - p*70)*f + (3000 - 304*p)*g) = 0 # calculate - f / g (g will not be zero) r = RF(3000 - 304*p, 300 - p*70) if r > 0: continue f, g = abs(r.numerator), abs(r.denominator) if not (0 < f < 10 and g < 10): continue # double check if 100 * (73*f + 334*g) / (70*f + 304*g) - 100 != p: continue print(f"answer: {10 * g + f} pounds per night")LikeLike