Teaser 2690: Leaving present
From The Sunday Times, 13th April 2014 [link]
When maths teacher Adam Up reached the age of 65, he asked his colleagues for some spring bulbs as a leaving present. So they gave him some packs of bulbs with, appropriately enough, each pack containing 65 bulbs.
Adam planted all the bulbs in clumps of different sizes, the number of bulbs in each clump being a prime number. Furthermore, these prime numbers overall used each of the ten digits exactly once. Had he been given any fewer packs this would have been impossible.
How many bulbs were there in the smallest and largest clumps?
[teaser2690]
Jim Randell 10:42 am on 6 December 2022 Permalink |
I implemented a multiset exact cover algorithm [[
mcover()
]] when I revisited Enigma 1712. And the same function can be used to solve this puzzle.As we are looking for the smallest number of packs we can start by considering primes up to 65, to see if the problem can be solved using a single pack, and if not we can then add primes between 66 and 130 into the mix, and so on until we find a number of packs that provides solutions.
The following Python program runs in 56ms. (Internal run time is 3.7ms).
Run: [ @replit ]
Solution: The smallest clump had 5 bulbs. The largest clump had 401 bulbs.
There are 2 ways to achieve the solution with 9 packs of 65 bulbs (= 585 bulbs in total):
LikeLike
GeoffR 7:02 pm on 6 December 2022 Permalink |
The only way I could find a solution in MiniZinc was to assume the ten digit pattern of the primes i.e. 1,2,2,2,3. There has to be at least one 3-digit prime with zero as the middle digit.
Out of interest I then adapted the program to check a different prime digit pattern, which was 2,2,3,3 for the ten digits. All the answers used 18 packs of 65 bulbs, exactly double the original solution using 9 packs of 65 bulbs = 585
LikeLike