Brainteaser 1747: Lottery charges
From The Sunday Times, 10th March 1996 [link]
Chargealot are having a new set of lottery balls made. They are going to be painted with numbers from 1 (not 01) to 49. The painter decides that this is one chance to make a fortune from the lottery and so he charges accordingly. He divides the digits into two types and charges a certain whole number of pounds for painting each digit of one type (each time it occurs) and a different whole number of pounds for all the other digits (each time they occur). Both charges are more than £50 but less than £100.
To make the cost sound reasonable, instead of quoting a price for the whole set he quoted the average price per ball. Of course some balls cost less than average, and some balls cost more, but just one ball’s price was equal to the average.
What were his two charges per digit?
This puzzle is included in the book Brainteasers (2002). The puzzle text above is taken from the book.
[teaser1747]








Jim Randell 9:07 am on 17 November 2019 Permalink |
We can divide the digits from 0-9 into two sets, “type A” and “type B” with associated costs a and b.
There are 9 single digit numbers and 40 2-digit numbers, so the 49 numbers use 89 digits in total.
If, in total, there are nA type A digits and nB type B digits then we have:
where T is the total cost and m is the average cost per ball, and only one of the balls can cost the average amount.
This Python program runs in 158ms.
Run: [ @repl.it ]
from collections import defaultdict from enigma import subsets, diff, irange, nsplit, div, printf # place 0 in set A and choose some other digits to go in set B for B in subsets(irange(1, 9), min_size=1): A = diff(irange(0, 9), B) # group the numbers by (A, B) usage d = defaultdict(list) nA = 0 for n in irange(1, 49): # count the A and B digits k = [0, 0] for x in nsplit(n): k[x in B] += 1 d[tuple(k)].append(n) nA += k[0] nB = 89 - nA # find a number in a class by itself for ((i, j), vs) in d.items(): if len(vs) != 1: continue # find costs for the digits in A and B for a in irange(51, 99): b = div(a * (49 * i - nA), nB - 49 * j) if b is None or b < 51 or b > 99: continue # check none of the other groups cost the same as the mean m = a * i + b * j if any(a * x + b * y == m for (x, y) in d.keys() if not(x == i and y == j)): continue # output solution printf("cost = ({a}, {b}), digits = ({A}, {B}); mean = {m}, number = {vs[0]}")Solution: Each digit costs £ 74 or £ 83.
The ball that costs the mean amount is one of the repeated digit balls, i.e. 11, 22, 33, 44. It costs £ 148 (i.e. 2× £ 74).
The digit used twice on the mean ball is the only digit that costs £ 74, all the other digits cost £ 83.
The total cost for all the balls is therefore £ 7252.
LikeLike