Enigmatic Code

Programming Enigma Puzzles

Enigma 402: A DIY puzzle

From New Scientist #1552, 19th March 1987 [link]

In the puzzle below, select some of the guest lists and discard the remainder. The lists you keep should make a puzzle which has exactly one solution and involves no more lists than is necessary.

Who did it?

by …

There has been a series of robberies at house parties recently. Each was clearly a one-man job — the same man each time — and each was an inside job. The possible suspects are Alan, Bryan, Chris, David, Eric, Fred, George, Harry, Ian, Jack, Ken and Len. The male guest list at the parties were as follows:

1. All but David, George and Len.
2. Bryan, Chris, Eric, Harry, Ian and Ken.
3. All but Bryan and Ken.
4. Chris and Ian.
5. All but Alan, Fred, Jack and Len.
6. Bryan, Chris, Ian and Ken.
7. All but Eric and Harry.
8. All but David and George.
9. All but Chris and Ian.
10. All but Alan and Fred.

Who carried out the robberies?

Which lists should you use in your puzzle?

What is the answer to your puzzle?

[enigma402]

Advertisements

One response to “Enigma 402: A DIY puzzle

  1. Jim Randell 23 June 2017 at 8:40 am

    This Python program runs in 44ms.

    from itertools import combinations
    from enigma import irange, printf
    
    # the lists of guests
    guests = {
      1: 'ABCEFHIJK',
      2: 'BCEHIK',
      3: 'ACDEFGHIJL',
      4: 'CI',
      5: 'BCDEGHIK',
      6: 'BCIK',
      7: 'ABCDFGIJKL',
      8: 'ABCEFHIJKL',
      9: 'ABDEFGHJKL',
      10: 'BCDEGHIJKL',
    }
    
    # turn the guest lists into sets
    for (k, v) in guests.items(): guests[k] = set(v)
    
    # consider subsets of size k
    for k in irange(2, 10):
      ss = list()
      for s in combinations(guests.keys(), k):
        # find guests that are in all lists
        gs = set.intersection(*(guests[i] for i in s))
        if len(gs) == 1:
          printf("[{k}: {s} -> {gs}]")
          ss.append((s, gs.pop()))
    
      if ss:
        for (s, g) in ss:
          printf("lists = {s}, robber = {g}")
        break
    

    Solution: The puzzle should use lists 1, 3, 7, 9, 10. The answer to the puzzle is that Jack is the robber.

    The solution uses 5 of the lists, but we can also include list 8. But these are the only subsets that uniquely identify a single guest.

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: