Sunday Times Teaser 3317 – Hitting All the Spots
by Bill Kinally
Published Sunday April 19 2026
A board game uses three coloured tetrahedral dice (red, green and blue) to determine which numbers are hit when the three dice are rolled. The 12 faces of the three dice each have different numbers, comprising a 1 and the primes from 2 to 31. A hit is made when it is the number rolled on any of the dice, the sum of any two numbers rolled or the sum of all three numbers rolled.
The arrangement of the numbers on each die made it possible to hit every number in a range and this range was as large as it could be. The green die has numbers 2, 5, 7, 11 and the blue die also has three consecutive primes.
In ascending order, what are the numbers on the red die?
3 Comments
Leave one →
-
Frits permalink1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950from itertools import combinations, product# return the number of elements in the biggest rangedef biggest_range(dice):# collect number rolled on any of the dicehits = set(n for die in dice for n in die)# pick one number from each diefor p in product(*dice):# collect the sum of any two numbers rolledfor c2 in combinations(p, 2):hits |= {sum(c2)}# collect the sum of all three numbers rolledhits |= {sum(p)}# determine biggest ranges = sorted(hits)cnt, mx = 1, 0# compare 2 adjacent numbersfor n1, n2 in zip(s, s[1:]):if n2 == n1 + 1:cnt += 1else:mx = max(mx, cnt)cnt = 1return mxnums = [1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]snums = set(nums)green = {2, 5, 7, 11}remaining = snums - greensols, mx = [], 0# choose 3 consecutive prime numbers for the blue diefor i in range(10):# 3 consecutive prime numbersb3 = set(nums[i:i+3])if any(n in green for n in b3): continue# choose the 4th prime number for the blue diefor b in (remaining - b3):red = remaining - (blue := b3 | {b})# calculate the number of elements in the biggest rangen = biggest_range((green, blue, red))if n > mx:sols = []mx = nif n >= mx:sols.append(red)print("answer:", ' or '.join(str(sorted(sol)) for sol in sols))
-
John Z permalink123456789101112131415161718192021222324252627282930313233343536373839from itertools import productnumbers = (1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31)# minimum range for only one side consideredra = min(i for i in range(len(numbers)) if i + 1 != numbers[i])# numbers on green die are givengreen = (2, 5, 7, 11)# consider starting point for three consecutive primes on blue diefor i in range(6, 10):blue_ = numbers[i:i+3]# consider fourth number on blue diefor j in set(numbers) - set(green) - set(blue_):blue = blue_ + (j,)# reinitialize the set of 'hits'hits = set(numbers)# the red die is composed of the remaining numbersred = set(numbers) - set(green) - set(blue)# 'roll' the dicefor grb in product(green, blue, red):# accumulate hitshits |= {sum(grb), grb[0] + grb[1], grb[1] + grb[2], grb[0] + grb[2]}# sort hits in preparation for range determinationhits = sorted(hits)# get the new 'range' for the hits foundnew_ra = min(i for i in range(len(hits)) if i + 1 != hits[i])# if it's greater than the old range, saveif new_ra > ra:ra = new_raGREEN, BLUE, RED = green, sorted(blue), sorted(red)HITS = hitsprint(f'Range: {ra} {GREEN = } {BLUE = } {RED = }')print(f'{HITS=}')