Enigmatic Code

Programming Enigma Puzzles

Tantalizer 12: Aunts

From New Scientist #562, 14th September 1967 [link]

“Be a dear”, said Aunt Agatha, “and write to that nice man about the things”.

“Which nice man about what things?” I asked.

“The man who collects beetles about the hymn-books”, replied my aunt without hesitation. “Here’s his address:

Ernest Baggins,
Mallards,
Appleton,
Kent”.

“That doesn’t sound right, dear”, interrupted Aunt Maud. “I’m sure he’s not Baggins. Where’s my book? Yes, here we are:

Ernest Boggins,
Halyards,
Bladon,
Surrey”.

“That’s not what I’ve got”, put in Aunt Jobiska. “I’ve got:

Edward Biggins,
Haystacks,
Cuxham,
Surrey”.

“Not Biggins, Jobiska, Boggins”, this from Aunt Kate.

“Edward Boggins,
Pollards,
Appleton,
Sussex”.

“Stuff!”, said Aunt Tabitha rudely, “He is called Ernest Buggins, poor man, and his address is:

Willows,
Bladon,
Surrey”.

As no Aunt was willing to give way, I had to ring the vicar and he, it turned out, was both deaf and loquacious. However, I got the name and address in the end and found that each aunt had been right in exactly two out of her five particulars.

What is his name and address?

A version of this puzzle appears in the book Tantalizers (1970) under the title “Aunt Maud”.

[tantalizer12]

2 responses to “Tantalizer 12: Aunts

  1. Jim Randell 31 May 2023 at 11:06 am

    See also: Tantalizer 10, Teaser 3122.

    This Python program runs in 61ms. (Internal runtime is 2.3ms).

    Run: [ @replit ]

    from enigma import (unzip, union, cproduct, seq2str, printf)
    
    # statements
    statements = [
      ('Ernest', 'Baggins', 'Mallards',  'Appleton', 'Kent'),
      ('Ernest', 'Boggins', 'Halyards',  'Bladon',   'Surrey'),
      ('Edward', 'Biggins', 'Haystacks', 'Cuxham',   'Surrey'),
      ('Edward', 'Boggins', 'Pollards',  'Appleton', 'Sussex'),
      ('Ernest', 'Buggins', 'Willows',   'Bladon',   'Surrey'),
    ]
    
    # collect possible values for each attributes
    attrs = list(union([xs, ['???']]) for xs in unzip(statements))
    
    # count matches
    correct = lambda xs, ys: sum(x == y for (x, y) in zip(xs, ys))
    
    # consider possible attributes
    for ss in cproduct(attrs):
      # each statement is correct in exactly 2 attributes
      if not all(correct(ss, xs) == 2 for xs in statements): continue
      printf("{ss}", ss=seq2str(ss, sep=" ", enc=""))
    

    Solution: The correct address is:

    Ernest Biggins
    Pollards
    Appleton
    Surrey

    • GeoffR 2 June 2023 at 4:48 pm
      # List of possible aunts' statements
      statements = []
       
      # Aunts' witness statements
      W1 = ['Ernest', 'Baggins', 'Mallards',  'Appleton', 'Kent']
      W2 = ['Ernest', 'Boggins', 'Halyards',  'Bladon',   'Surrey' ]
      W3 = ['Edward', 'Biggins', 'Haystacks', 'Cuxham',   'Surrey' ]
      W4 = ['Edward', 'Boggins', 'Pollards',  'Appleton', 'Sussex'] 
      W5 = ['Ernest', 'Buggins', 'Willows',   'Bladon',   'Surrey' ]
      
      # Form lists of all possible witness statements
      # There are 2 x 4 x 5 x 3 x 3 = 360 no. possible statements
      # a = first name, b = last name, c = house, d = village, e = county
      for a in ('Ernest', 'Edward'): 
        for b in ('Baggins', 'Biggins', 'Boggins', 'Buggins'):
          for c in ('Mallards', 'Halyards', 'Haystacks', 'Pollards', 'Willows'):
            for d in ('Appleton', 'Bladon', 'Cuxham'):
              for e in ('Kent', 'Surrey', 'Sussex'):
                statements.append([a, b, c, d, e])
      
      # Iterate through all statements for each aunt
      for st in statements:
          a, b, c, d, e = st
          # Two statements from five are true for each aunt
          # test Aunt No.1 statements (Agatha)
          if sum([a == W1[0], b == W1[1], c == W1[2], \
                  d == W1[3], e == W1[4]]) == 2:
             
            # test Aunt No.2 statements (Maud)
            if sum([a == W2[0], b == W2[1], c == W2[2], \
                    d == W2[3], e == W2[4]]) == 2:
               
              # test Aunt No.3 statements (Jobiska)
              if sum([ a == W3[0], b == W3[1], c == W3[2], \
                       d == W3[3], e == W3[4]]) == 2:
               
                # test Aunt No.4 statements (Kate)
                if sum([a == W4[0], b == W4[1], c == W4[2], \
                        d == W4[3], e == W4[4]]) == 2:
                   
                  # test Aunt No.5 statements (Tabitha)
                  if sum([ a == W5[0], b == W5[1], c == W5[2], \
                           d == W5[3], e == W5[4]]) == 2:
                    # print his name and address
                    print(f"His Name was {a} {b}.",
                          f"\nHis address was {c}, {d}, {e}.")
                    
      # His Name was Ernest Biggins. 
      # His address was Pollards, Appleton, Surrey.
      
      
      
      
      

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.