Enigmatic Code

Programming Enigma Puzzles

Enigma 1026: Dualities

From New Scientist #2182, 17th April 1999 [link]

Across:

1. A prime which is also a square reversed. The first two digits form a square, and the last two a prime. The 1st, 3rd and 5th digits are all the same.
4. The square root of 7 across.
5. A palindromic square.
6. The square root of the reverse of 2 down.
7. A square which is prime when reversed.

Down:

1. A prime which is also a square reversed. The first three digits form a square which is also a square when reversed. The last two digits form a prime which is also a prime when reversed.
2. A prime which is also a square when reversed. All the digits are different. The first three digits form a square which is also a square when reversed: and the last digit is the same as that of 1 down.
3. A square which is a prime when reversed.

Find the answers for 1 across, 1 down, 3 down and 7 across.

[enigma1026]

One response to “Enigma 1026: Dualities

  1. Jim Randell 25 January 2019 at 7:52 am

    Several of the digits are equated with each other, either directly or by the use of palindromic numbers.

    We can apply these and then use the [[ SubstitutedExpression() ]] solver from the enigma.py library to solve the remaining conditions of the puzzle.

    The following run file executes in 142ms.

    Run: [ @repl.it ]

    #  we transform the first grid to the second by equating:
    #
    #  A = C = E, P = K, N = L, X = V
    #
    #  A B C D E      A B A D A
    #  F G H I J      F G H I J
    #  K L M N P  ->  K L M L K
    #  Q R S T U      Q R S T U
    #  V W X Y Z      V W V Y Z
    
    SubstitutedExpression
    
    --distinct="AHMSV"
    --template="Across: 1. {ABADA}; 4. {GHI}; 5. {KLMLK}; 6. {RST}; 7. {VWVYZ} / Down: 1. {AFKQV}; 2. {AHMSV}; 3. {AJKUZ}"
    --solution=""
    --header=""
    
    # 1a = ABADA
    # "A prime ..."
    "is_prime(ABADA)"
    # "... which is also a square reversed ..."
    "is_square(ADABA)"
    # "... the first 2 digits form a square ..."
    "is_square(AB)"
    # "... the last 2 digits form a prime ..."
    "is_prime(DA)"
    
    # 4a = GHI
    # "the square root of 7 across"
    "GHI ** 2 = VWVYZ"
    
    # 5a = KLMLK
    # "a palindromic square"
    "is_square(KLMLK)"
    
    # 6a = RST
    # "the square root of the reverse of 2 down"
    "RST ** 2 = VSMHA"
    
    # 7a = VWVYZ
    # "a square ..."
    "is_square(VWVYZ)"
    # "... which is a prime when reversed"
    "is_prime(ZYVWV)"
    
    # 1d = AFKQV
    # "a prime ..."
    "is_prime(AFKQV)"
    # "... which is also a square reversed ..."
    "is_square(VQKFA)"
    # "... the first 3 digits form a square ..."
    "is_square(AFK)"
    # "... which is also a square when reversed ..."
    "is_square(KFA)"
    # "... the last 2 digits form a prime ..."
    "is_prime(QV)"
    # "... which is also a prime when reversed"
    "is_prime(VQ)"
    
    # 2d = AHMSV
    # "a prime ..."
    "is_prime(AHMSV)"
    # "... which is also a square when reversed ..."
    "is_square(VSMHA)"
    # "... all the digits are different ..." (see --distinct)
    # "... the first 3 digits form a square ..."
    "is_square(AHM)"
    # "... which is also a square when reversed ..."
    "is_square(MHA)"
    
    # 3d = AJKUZ
    # "a square ..."
    "is_square(AJKUZ)"
    # "... which is a prime when reversed"
    "is_prime(ZUKJA)"
    

    Solution: 1 across = 16141; 1 down = 14437; 3 down = 18496; 7 across = 70756.

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: