Teaser 3035: Friend of the Devil
From The Sunday Times, 22nd November 2020 [link]
My friend, “Skeleton” Rose, rambled on with me and my uncle (“The Devil” and “Candyman”) about Mr Charlie, who gave, between us, three identical boxes of rainbow drops.
Each identical box’s card template had a white, regular convex polygonal base section with under ten sides, from each of which a similar black triangular star point extended. All these dark star points folded up to an apex, making an enclosed box.
The number of sweets per box equalled the single-figure sum of its own digits times the sum of the star points and the box’s faces and edges. If I told you how many of the “star point”, “face” and “edge” numbers were exactly divisible by the digit sum, you would know this number of sweets.
How many sweets were there in total?
[teaser3035]
Jim Randell 4:52 pm on 20 November 2020 Permalink |
If the base of the box is a k-gon (so 3 ≤ k < 10), then there are k “star points” and the closed box forms a polyhedron with (k + 1) faces and 2k edges.
So if there are n sweets in the box, we have:
The largest possible digit sum is 9, and the largest possible value for k is also 9, so the maximum value for n is 9×(4×9 + 1) = 333.
This Python program considers sweet numbers (up to 333) and finds numbers unique by the given measure. It runs in 45ms.
Run: [ @repl.it ]
Solution: There were 666 sweets in total.
There are 222 sweets in each of the three boxes.
The digit sum of 222 is 6.
The base of each box is a regular nonagon (9 sides), so the number of star points is 9, the number of faces of the shape formed by the (closed) box is 10, and the number of edges is 18.
The digit sum (6), multiplied by the sum of the star points (9), faces (10), and edges (18) = 6×(9 + 10 + 18) = 6×37 = 222, the same as the number of sweets in the box.
And this is the only case where just one the three summands (edges = 18) is divisible by the digit sum (6).
There are 8 candidate numbers of sweets, grouped by the shape of the boxes:
LikeLike
Jim Randell 9:08 am on 21 November 2020 Permalink |
Here is a more efficient version, that also does not need the upper bound on the number of sweets.
Run: [ @repl.it ]
LikeLike