From The Sunday Times, 8th November 1981 [link]
The exclusive Ichthyophage Club was invited to hold its annual dinner at a resort on the Costa Fortuna last summer. Several members accepted the invitation, and each was asked to bring one of the local seafood specialities as their contribution to the feast.
The fare consisted of:
• the local edible starfish, which has five legs,
• the squid, which has ten,
• and octopus.
Each guest provided one such creature, and in fact more people provided octopus than provided starfish.
A chef was hired locally. He arranged the food so that each guest received a plateful consisting of the same number of legs — at least one leg from each species — but no guest’s plate was made up in the same way as any other guest’s plate. In other words, no guest had the same combination of legs on his plate as any other guest did.
When the food had been arranged in this way, the chef was grieved to find that all the legs had been used, leaving no edible fragments for him to take home to his family.
How many guests were there?
How many brought starfish, how many brought squid, and how many brought octopus?
This puzzle is included in the book The Sunday Times Book of Brainteasers (1994).
[teaser1006]
Jim Randell 7:30 am on 13 March 2026 Permalink |
The following run file executes in 105ms. (Internal runtime of the generated code is 22ms).
Solution: The time/date is: 13:54, 26/09/78.
i.e. 1:54pm on 26th September 1978.
And:
The code doesn’t check that a valid date is produced, but it easy to see that the only candidate solution corresponds to a valid date, so such a check is not necessary.
LikeLike
ruudvanderham 2:22 pm on 13 March 2026 Permalink |
This code checks only valid dates:
import peek import istr number_of_days_in_month = [None, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] istr.int_format("02") for hour in istr.range(24): if hour.all_distinct(): for minute in istr.range(60): if (hour | minute).all_distinct(): for year in istr.range(100): if (hour | minute | year).all_distinct(): for month in istr.range(1, 13): if (hour | minute | year | month).all_distinct(): for day in istr.range(number_of_days_in_month[int(month)] + 1): if (hour | minute | year | month | day).all_distinct(): if (hour * minute * year * month * day).is_cube(): peek(hour, minute, year, month, day)LikeLike
ruudvanderham 4:46 pm on 13 March 2026 Permalink |
Here is a recursive version (that doesn’t check for valid dates):
import istr istr.int_format("02") def solve(sofar, ranges): if ranges: for i in ranges[0]: if (sofar | i).all_distinct(): solve(sofar | i, ranges[1:]) else: if (sofar[0:2] * sofar[2:4] * sofar[4:6] * sofar[6:8] * sofar[8:10]).is_cube(): print(f"{sofar[0:2]}:{sofar[2:4]} {sofar[4:6]}/{sofar[6:8]}/{sofar[8:10]}") solve(istr(""), [istr.range(24), istr.range(60), istr.range(1, 32), istr.range(1, 13), istr.range(100)])LikeLike