Enigmatic Code

Programming Enigma Puzzles

Enigma 1473: Even odds

From New Scientist #2634, 15th December 2007

Connah Tiste runs an unusual fairground stall.  It consists of 15 touching circular lights as shown.

You pay £1 and three of the lights come on, the trio being chosen completely at random. If the centres of the lit circles form the corners of an equilateral triangle, you win £10.

Recently one of the bulbs developed a fault which means it never lights up. Each punter now gets a random trio from the remaining lights. Connah has decided to do nothing about correcting the fault because it lowers the chances of him having to pay out. In fact he will now expect to pay out once in every certain whole number of goes.

How many?

[enigma1473]

Advertisements

4 responses to “Enigma 1473: Even odds

  1. Jim Randell 15 January 2013 at 11:17 pm

    The following Python program runs in 51ms.

    from itertools import product, combinations
    from fractions import Fraction
    from enigma import irange, printf
    
    # using a co-ordinate system where the axes are 60 degrees apart.
    
    # the distance metric is: (cosine rule)
    def d2(p, q):
      (a, b) = (p[0] - q[0], p[1] - q[1])
      return a * a + b * b + a * b
    
    # positions of the lights
    vs = set((a, b) for a in irange(0, 4) for b in irange(0, 4 - a))
    
    # count the number of choices and the number of triangles
    def count(vs):
      (n, e) = (0, 0)
      for (a, b, c) in combinations(vs, 3):
        n += 1
        # is the triangle equilateral?
        if d2(a, b) == d2(b, c) == d2(a, c): e += 1
      return (e, n)
    
    (e, n) = count(vs)
    p0 = Fraction(e, n)
    printf("[<none>] {n} choices, {e} equilateral triangles, p={p0}")
    
    # one of the bulbs has blown
    # there are only four different positions to consider
    for b in ((0, 0), (1, 0), (2, 0), (1, 1)):
      (e, n) = count(vs.difference([b]))
      p = Fraction(e, n)
      x = '*** SOLUTION ***' if p < p0 and p.numerator == 1 else ''
      printf("[{b}] {n} choices, {e} equilateral triangles, p={p} {x}")
    

    Solution: He would expect to pay out on 1 out of 14 games.

  2. Hugh Casement 8 October 2014 at 12:35 pm

    At first I thought we have an incorrect solution.

    When all 15 bulbs are working, there are 15!/(12! 3!) = 455 different configurations of three lit bulbs. The possible equilateral triangles are sixteen of side 1, seven of side 2, three of side 3, one of side 4; as well as six of side root(3) perpendicular to the sides of the array, and also — easy to miss — two more of side root(7) at about 19°:

            ●
          ○   ●
        ●   ●   ●		and its mirror image
      ●   ●   ●   ○		(sorry if it looks a bit wonky here)
    ●   ○   ●   ●   ●

    That makes 35 in all, so the suckers have a 1-in-13 chance of winning.

    I think we have to assume that a bulb does not blow, for then people would notice that sometimes only two come on. Rather, the random mechanism just ignores one of them. There are 14!/(11! 3!) = 364 different configurations of the remaining 14 bulbs. Which equilateral triangles don’t appear depends on which bulb is out of action: if it’s one of the corner ones, then obviously the triangle of side 4 is one of them, for example.

    As you say, we have to distinguish four cases of crippled bulb:
    corner (3 possibilities): 31 triangles still possible
    next to corner (6 possibilities): 28
    mid-side (3 possibilities): 27
    inner (3 possibilities): 26.
    The (weighted) mean is 28, representing a 1-in-13 chance as before.
    So on average it makes no difference that one bulb is not working.

    After thinking about it I realized that the sideshow owner of course knew it was one of the inner bulbs and worked out the improved 1-in-14 chance.
    If it had been one of the corner ones we can bet he’d have fixed it double quick!

Leave a Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: