Brain-Teaser 452: [Coloured dice]
From The Sunday Times, 11th January 1970 [link]
Three dice, numbered from 1 to 6, each had 2 blue, 2 red and 2 white faces. No number appeared in the same colour twice.
When Bill threw the dice they totalled 14, showing 2 white faces and 1 red. A second throw showed each die the same colour as before, but each had a different number totalling 15. On one die Bill noticed two similarly coloured sides added to 9.
The telephone rang and Bill went to answer it, leaving little Tommy by himself, who then picked up one of the dice and painted a red face white and a white face red. He then threw the dice twice producing firstly 3 whites and then 3 reds, each throw showing one of the repainted sides.
Tommy totalled the 3 whites to 8 and the 3 reds to 7. Unfortunately, sums were not his strong point and though he sometimes got them right, quite often he was 1 out, and sometimes even 2 out. However, he was certain that the 3 whites totalled more than the 3 reds.
What numbers did Tommy repaint (1) red, and (2) white?
This puzzle was originally published with no title.
[teaser452]
Jim Randell 10:55 pm on 16 February 2019 Permalink |
This Python program runs in 370ms.
Run: [ @repl.it ]
from collections import namedtuple from itertools import permutations, combinations, product from enigma import irange, partitions, printf # represent a die Die = namedtuple("Die", "B R W") # collect possible dice dice = set(Die(*s) for ns in partitions(irange(1, 6), 2) for s in permutations(ns)) # can we make the numbers in <ns> from the opposite faces of <fs> def make(ns, fs): ns = set(ns) (f1, f2, f3) = fs return any(ns.issubset([f1[i1] + f2[i2] + f3[i3], f1[1 - i1] + f2[1 - i2] + f3[1 - i3]]) for (i1, i2, i3) in product((0, 1), repeat=3)) # change tuple <t> so index <i> is <v> def change(t, i, v): t = list(t) t[i] = v return tuple(t) # possible white, red values for Tommy (white > red) ts = set((w, r) for w in irange(6, 10) for r in irange(5, w - 1)) # choose a set of three dice for (d1, d2, d3) in combinations(dice, 3): # "no number appeared in the same colour twice" if not all(len(set(x1 + x2 + x3)) == 6 for (x1, x2, x3) in zip(d1, d2, d3)): continue # "on one of the dice two similary coloured sides add up to 9" if not any(sum(x) == 9 for x in d1 + d2 + d3): continue # can we make a R, W, W combination that sums to 14 and 15 if not any(make((14, 15), fs) for fs in [(d1.R, d2.W, d3.W), (d1.W, d2.R, d3.W), (d1.W, d2.W, d3.R)]): continue # Tommy picked one of the dice and swapped the colours of a red number and a white number, suppose he repaints t1 for (t1, t2, t3) in [(d1, d2, d3), (d2, d1, d3), (d3, d1, d2)]: # choose red/white faces of t1 to repaint for (r, w) in product((0, 1), repeat=2): # the repainted die t = Die(B=t1.B, R=change(t1.R, r, t1.W[w]), W=change(t1.W, w, t1.R[r])) # record possible 3 white/red scores (including the repainted faces) ws = set(sum(s) for s in product([t.W[w]], t2.W, t3.W)) rs = set(sum(s) for s in product([t.R[r]], t2.R, t3.R)) # do these create feasible values? vs = ts.intersection(product(ws, rs)) if vs: printf("dice: {t1} {t2} {t3}") printf(" red = {r}, white = {w} -> {vs}", r=t.R[r], w=t.W[w])Solution: (1) Tommy repainted 3 to red, (2) and 4 to white.
There is only one possible set of dice:
The throws for Bill, showing 2 white faces and 1 red:
Both die 1 and die 2 have white faces that sum to 9.
Tommy chooses die 1 and repaints 3 from white to red, and 4 from red to white, giving (with the repainted faces indicated in braces):
Tommy then throws 3 whites (totalling 6 to 10), and then 3 reds (totalling 5 to 9), the white total being more than the red total.
So Tommy’s calculation of 8 for the reds and 7 for the whites were both out by 2.
LikeLike