Enigmatic Code

Programming Enigma Puzzles

Tantalizer 432: A way with the ladies

From New Scientist #983, 15th January 1976 [link]

The Rätselgarten in Vienna is famous for its twenty goddesses, whos statues stand at the junctions of its paths. The task of keeping them spick and span belongs to Stephan Schnitzel. Once a month he dusts and polishes them, following a route of his own design which, without leaving the paths show, takes him to each goddess exactly twice.

Each goddess has a different letters on the plan in his office and his order of visiting is, he tells me:

P A D M O I C T F K G B J R H N L Q E S P A L Q J R H N D M O I C T S F E K G B.

But, as you will no doubt spot without even being told which letter to put at which junction, he has made a small error in the telling. He has inadvertently put two consecutive letters in the wrong order somewhere.

Can you work out which they are?

[tantalizer432]

One response to “Tantalizer 432: A way with the ladies

  1. Jim Randell 3 April 2019 at 8:49 am

    We have solved a similar puzzle to this one before. See Enigma 56 (also by Martin Hollis).

    If we colour the nodes of the graph as follows:

    We see that we can only proceed to a green node from a red node, and vice versa. So any path will alternate between visiting red and green nodes.

    We can therefore partition the given route into those nodes in an odd position and those in an even position.

    For a valid route each node will appear either in only odd positions, or only even positions.

    So we can find the transposed nodes by looking for those that appear in both partitions.

    This Python program runs in 95ms.

    Run: [ @repl.it ]

    from enigma import printf
    
    # given route
    route = "PADMOICTFKGBJRHNLQESPALQJRHNDMOICTSFEKGB"
    
    # partition the nodes
    even = route[0::2]
    odd = route[1::2]
    
    # find transposed nodes (that appear in both partitions)
    t = set(even).intersection(odd)
    if len(t) == 2:
      printf("transposed = {t}", t=sorted(t))
    

    Solution: F and S have been transposed.

    F and S only appear in adjacent positions towards the end, so the correct route should end:

    … M O I C T F S E K G B

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s

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

%d bloggers like this: