Enigmatic Code

Programming Enigma Puzzles

Enigma 991: Add it up

From New Scientist #2146, 8th August 1998 [link]

Throughout the following equations each letter stands consistently for either a non-zero digit or for one of the arithmetic symbols ×, ÷, + and –, with different letters being used for different symbols/digits.

When you have substituted the digits and symbols both equations make sense working from left to right (so that, for example, 5 – 2 × 23 = ((5 – 2) × 23) = 69), are correct, and, as our title implies, a + features somewhere.

AN = ENIGMA
ADDIT = UP

Find the value of AND.

[enigma991]

One response to “Enigma 991: Add it up

  1. Jim Randell 27 September 2019 at 7:30 am

    Considering the expression:

    ADDIT = UP

    I must be an operator (as D cannot be – we can’t have two operators next to each other), so the expression is one of:

    ADD + T = UP
    ADD – T = UP
    ADD × T = UP
    ADD ÷ T = UP

    We can immediately see that + and × are not going to give a 2-digit result, which means that the + must be in the other expression, so the two expressions are one of:

    AN = EN – G + A; ADD – T = UP
    AN = EN ÷ G + A; ADD ÷ T = UP

    Applying the operations from left-to-right we get:

    M(I(EN, G), A) = AN
    I(ADD, T) = UP

    where M is +, and I is – or ÷.

    This Python program uses the [[ SubstitutedExpression() ]] solver from the enigma.py library to try both options. It runs in 101ms.

    Run: [ @repl.it ]

    import operator
    from itertools import product
    from enigma import SubstitutedExpression, irange, sprintf as f, printf
    
    # output header for both possibilities
    printf("(<M>(<I>(EN, G), A) = AN) (<I>(ADD, T) = UP) (AND)")
    
    for (M, I) in product([ "add" ], [ "sub", "div" ]):
      SubstitutedExpression(
        [ f("{M}({I}(EN, G), A) = AN"), f("{I}(ADD, T) = UP") ],
        digits=irange(1, 9),
        env=dict(add=operator.add, sub=operator.sub),
        answer="AND",
        header=""
      ).go()
    

    Solution: AND = 187.

    The expressions are:

    AN = EN ÷ G + A → 18 = ((68 ÷ 4) + 1)
    ADD ÷ T = UP → (177 ÷ 3) = 59

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: