Teaser 3030: Pot success
From The Sunday Times, 18th October 2020 [link]
In snooker, pot success (PS) is the percentage of how many pot attempts have been successful in that match (e.g. 19 pots from 40 attempts gives a PS of 47.5%). In a recent match, my PS was a whole number at one point. I then potted several balls in a row to finish a frame, after which my improved PS was still a whole number. At the beginning of the next frame, I potted the same number of balls in a row, and my PS was still a whole number. I missed the next pot, my last shot in the match, and, remarkably, my PS was still a whole number.
If I told you how many balls I potted during the match, you would be able to work out those various whole-number PS values.
How many balls did I pot?
[teaser3030]
Jim Randell 5:03 pm on 16 October 2020 Permalink |
This Python program runs in 46ms.
Run: [ @repl.it ]
Solution: You potted 13 balls.
This corresponds to the following scenario:
The other possible scenarios are:
It seems plausible that these could correspond to a snooker match (it is possible to pot 10 reds + 10 colours + 6 colours = 26 balls in one frame, and we know at least 2 frames are involved). Although if just one of them did not, then the other scenario would provide a further solution.
The program ensures that the PS values we are considering are non-zero, but allowing the initial PS to be zero gives a further solution:
LikeLike
Frits 11:06 am on 17 October 2020 Permalink |
@Jim, I think you should also consider p=4 as ps1 might be zero and zero also is a whole number .
Also if t would be (p + 1) then ps1, ps2 and ps3 would be 100 and ps2 would not be higher than ps1.
If you start t from (p+ 2) you don’t have to code the ps1 < ps2 check as it will always be the case.
Of course there always is a balance between efficiency and seeing right away that the code solves the requirements.
LikeLike
Jim Randell 11:50 am on 17 October 2020 Permalink |
@Frits: Unfortunately the term “whole number” isn’t precise. It can be used to mean the integers, the non-negative integers, or just the positive integers.
For this puzzle I took it to be the positive integers (which gets around a possible problem when considering PS values of 0), so I didn’t have to consider PS values of zero. Which is probably what the setter intended, as I’m sure the puzzle is meant to have a unique solution.
I also wanted to make the [[ ps1 < ps2 ]] condition explicit in the code (as without it there would be further solutions – which can be seen by removing the test).
LikeLike
Frits 1:28 pm on 17 October 2020 Permalink |
Assuming whole numbers are in the range (1, …, 100) and with the “improved PS” check (which is not needed if we use “AB < CD").
If we include zero as a whole number there are 2 solutions.
LikeLike