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:44 am on 17 October 2024 Permalink |
Here is a solution using the [[
SubstitutedExpression]] solver from the enigma.py library.The following run file executes in 92ms. (Internal runtime of the generated program is 15.4ms).
Solution: The phone number is 157326849.
Where:
There are 24 squares that can be formed from the digits 1-9 (each exactly once) that are at least twice this number.
The smallest is: 326597184, and the largest is: 923187456.
So we can suppose that the setter and his neighbour do not share an area code prefix in their phone numbers.
Manually:
A number consisting of the digits 1-9 has a digit sum of 45, and so must be divisible by 9, and so its square root must be divisible by 3.
Using the additional information that the neighbour’s number is at least twice the setter’s number, we can see that the leading digit of the setter’s number must be 1-4, so the 5 digit root is less than 22334, which means it must start with 1 or 2, and so there are only a few possible consecutive digit sets that need to be considered, and only {1, 2, 3, 4, 5} will form numbers divisible by 3.
So the candidates are: 12xxx, 13xxx, 14xxx, 15xxx, 21xxx. Where each xxx has 6 possibilities, which gives 30 possibilities.
From these we can eliminate any candidates ending in 51, 52, 53, 235, 243, 245, 345, 423, 435, 532 (as the squares will include 0 or a repeated digit), which brings us down to 16 candidates.
And only one of these squares is a reordering of the digits 1-9.
LikeLike
ruudvanderham 2:59 pm on 17 October 2024 Permalink |
Enumerating all 5 digit numbers with 5 consecutive numbers and then checking whether the square of that is pandigital:
from istr import istr for i in range(1, 6): for digit5 in istr.concat(istr.permutations(range(i, i + 5))): square_of_digit5 = digit5 * digit5 if len(square_of_digit5) == 9 and set(square_of_digit5) == set(istr.digits("1-9")): print(digit5, square_of_digit5)LikeLike
GeoffR 12:44 pm on 17 October 2024 Permalink |
As Brian points out on his PuzzlingInPython site for this teaser, the first number is less than 5.10^8 so its square root is less than 22361 and the leading digit is 1 or 2. My neighbour’s telephone number is not needed for the solution.
LikeLike
GeoffR 2:11 pm on 17 October 2024 Permalink |
# the first number is less than 5.10^8 so its square root # is less than 22361 and the leading digit is 1 or 2 # and 5 cconsecutive digits, in some order from itertools import permutations for p1 in permutations('12345'): a,b,c,d,e = p1 if a not in ('12'):continue abcde = int(a + b + c + d + e) tel_num = abcde ** 2 if tel_num > 5 * 10**8:continue if len(set(str(tel_num))) != 9 \ or len(str(tel_num)) != len(set(str(tel_num))): continue print('Tel_num =', tel_num)LikeLike