Teaser 3144: Beware the jabbers’ clock, my son!
From The Sunday Times, 25th December 2022 [link]
On the NHS vaccine booking website, my queue position updated every minute. My initial position was an odd value in the 9000s. This value had four different digits, and its leftmost digit and just two others in it were factors of it. Curiously, these properties applied to each of the decreasing four-figure values after the next eight updates. I also noticed that no value had a digit in common with its predecessor, no zeroes occurred before the fourth update and no nines after this.
My son, told just the above, found all the possible values from which a complete set could be selected. From these he was certain of more than one of the nine queue positions.
Give these certain positions in displayed order.
This completes the archive of puzzles from 2022.
[teaser3144]
Jim Randell 5:14 pm on 23 December 2022 Permalink |
I took “no zeroes occurred before the fourth update …” to mean there are no zeros in the first 4 numbers in the sequence (but it doesn’t imply that there necessarily is a zero digit in the 5th number in the sequence). And “… no nines after this” to mean that there are no nines in last 5 numbers of the sequence (and again, not implying that there is a 9 digit in 4th number in the sequence). Although I think that you can use a slightly different interpretation of these conditions and still come up with the same answer.
This Python program runs in 307ms.
Run: [ @replit ]
Solution: The positions that are certain are: 7315 and 4728.
7315 must occur as the 3rd value in the sequence, and 4728 must occur as the 6th value in the sequence.
There are 5 positions where only one set of digits can occur. But for some of these it is possible to construct more than one valid number from the digits:
Only 7315 and 4728 are unique in their respective positions.
In total there are 8832 possible sequences of 9 numbers.
LikeLike
Jim Randell 7:38 am on 24 December 2022 Permalink |
With a little analysis we can get a much faster run time (and the program is only a little longer).
First we note that the numbers must be of the form:
And as long as there is valid number that can be constructed using the non-leading digits we don’t really care what order they appear in when we look for the next number. So we can just consider the collection of digits.
Also, as successive numbers share no digits, as we construct numbers we can exclude the leading digit of the next number (as we already know what it will be).
Then at the end we take the collections of digits we have found that we know must appear in each position, we can look for those that give just one valid number, and we have found an answer.
This Python program runs in 56ms. (Internal run time is 963µs).
Run: [ @replit ]
LikeLike
Frits 12:48 am on 24 December 2022 Permalink |
A different approach. At the end only 39 candidate numbers remain.
LikeLike
Frits 5:47 pm on 24 December 2022 Permalink |
Borrowing Jim’s “intersect” call.
LikeLike
Jim Randell 4:41 pm on 26 December 2022 Permalink |
@Frits: That’s neat. I hadn’t thought of using the [[
SubstitutedExpression
]] solver.Here’s a run file that solves the puzzle (it does generate all possible sequences though, so it is not as fast as my second program).
This run file executes in 98ms.
Run: [ @replit ]
LikeLike
Hugh Casement 11:49 am on 1 January 2023 Permalink |
I found, in addition to those mentioned by Jim,
6492, 6924, 6948
eight possible numbers starting with 3 and also containing 015 or 156 in some order
seven possible numbers starting with 2 and all containing 4 and 8
twelve possible numbers starting with 1 and all containing 5.
LikeLike