Teaser 3038: Progressive raffle
From The Sunday Times, 13th December 2020 [link]
George and Martha were participating in the local village raffle. 1000 tickets were sold, numbered normally from 1 to 1000, and they bought five each. George noticed that the lowest-numbered of his tickets was a single digit, then each subsequent number was the same multiple of the previous number, e.g. (7, 21, 63, 189, 567). Martha’s lowest number was also a single digit, but her numbers proceeded with a constant difference, e.g. (6, 23, 40, 57, 74). Each added together all their numbers and found the same sum. Furthermore, the total of all the digits in their ten numbers was a perfect square.
What was the highest numbered of the ten tickets?
[teaser3038]
Jim Randell 4:52 pm on 11 December 2020 Permalink |
If the sum of the 5 terms of the geometric progression is t, and this is also the sum of the 5 term arithmetic progression (a, a + d, a + 2d, a + 3d, a + 4d), then we have:
So the sum must be a multiple of 5.
The following Python program runs in 44ms.
Run: [ @repl.it ]
Solution: The highest numbered ticket is 80.
Note that the [[
geom()
]] function will generate all possible geometric progressions, including those that have a non-integer common ratio, (e.g. for a 4 element progression we could have (8, 28, 48, 343)), but for a 5 element progression we would need the initial term to have a factor that is some (non-unity) integer raised to the 4th power, and the smallest possible value that would allow this is 2^4 = 16, which is not possible if the initial term is a single digit. So for this puzzle the solution can be found by considering only those progressions with an integer common ratio (which is probably what the puzzle wanted, but it could have said “integer multiple” to be completely unambiguous).LikeLike
GeoffR 7:48 pm on 11 December 2020 Permalink |
This programme produces three solutions, all with the same maximum value.
In only one of the solutions do the digits add to a perfect square.
LikeLike
Jim Randell 8:05 pm on 11 December 2020 Permalink |
@Geoff: There’s only one copy of each ticket, so both George and Martha’s sets of numbers are fully determined. (Even though we are only asked for the highest numbered ticket).
LikeLike
Frits 2:30 pm on 12 December 2020 Permalink |
The result of this piece of code are all numbers ending on a 1. This limits George’s lowest-numbered ticket to one number.
LikeLike
Frits 7:57 pm on 12 December 2020 Permalink |
The generated code can be seen with option verbose=256.
LikeLike
Tony Brooke-Taylor 9:10 am on 14 December 2020 Permalink |
My first solution generated the series explicitly and then applied the tests to each series, but then I realised we could equate the expressions for the sums of each series to reduce the sets of parameters we need to test. My second attempt was similar to below but instead of constraining the sum to a multiple of 5 I initially constrained my ‘b’ parameter to an integer, which I think is mathematically equivalent but came inside another loop so was less efficient.
LikeLike