Sunday Times Teaser 2518 – No Title
by Victor Bryant
Published December 26 2010 (link)
For an appropriate Boxing Day exercise, write a digit in each of the boxes (x) so that (counting all the digits from here to the final request) the following statements are true.
_____ | number of occurrences of 0 | x | _____ | total occurrences of 6’s and 7’s | x |
number of occurrences of 1 | x | total occurrences of 8’s and 9’s | x | ||
total occurrences of 2’s and 3’s___ | x | a digit you have written in another box___ | x | ||
total occurrences of 4’s and 5’s | x | the average of all your written digits | x | ||
___ |
What, in order, are the digits in your boxes?
One Comment
Leave one →
-
Brian Gladman permalink123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354# The total number of digits in the list is the 10 digits# plus the 8 yet to be entered - 18 in total. So the sum# of the answers for the first 6 questions is 18.## There is only 1 '0' digit.## Since the third and higher entries are all two or more,# there are only two 1's.## Define sum7 as the sum of the first seven entered digits# so that the average in box eight is av = (sum7 + av) / 8# - this shows that sum7 is divisible by seven so 18 plus# the seventh entry is divisible by seven, which makes the# two last entries 3# So we have entries [1, 2, a, b, c, d, 3, 3] with the sum# of 24, giving a + b + c + d = 15text = list('''Total number of 0's 1Total number of 1's 2Total number of 2's and 3's XTotal number of 4's and 5's XTotal number of 6's and 7's XTotal number of 8's and 9's XA digit you put in another box 3The average of the digits entered 3''')# partition an integer (x) into (n) partsdef partition(x, n, s=[]):if n == 1:yield s + [x]else:for i in range(1, x):yield from partition(x - i, n - 1, s + [i])# record position in the text of the unknown valuesposn = [i for i, X in enumerate(text) if X == 'X']# consider possible values for the four unknown entriesfor v in partition(15, 4):# enter them into the textfor p, n in zip(posn, v):text[p] = str(n)# count the numbers from the textn_count = [0] * 4for n in range(2, 10):n_count[(n // 2) - 1] += text.count(str(n))# check if the result is correctif v == n_count:print(''.join(text))