Enigmatic Code

Programming Enigma Puzzles

Enigma 284: Bungled addition

From New Scientist #1431, 22nd November 1984 [link]

The latest addition sum which Uncle Bungle has just made up was, of course, rather a long one. But in my opinion this was no excuse for his producing it proudly (yes, proudly), for his friends to see the mistake that he had made. What is meant to happen in these addition sums is for the same letter to stand for the same digit wherever it appears, and for different letters to stand for different digits. And so they do in this puzzle except for Uncle Bungle’s one silly mistake.

The sum looks like this:

Enigma 284

Which letter was wrong, and what should it be?

Write out the correct addition sum.

[enigma284]

Advertisements

One response to “Enigma 284: Bungled addition

  1. Jim Randell 29 May 2015 at 8:16 am

    This Python program uses the SubstitutedSum() solver from the enigma.py library. It runs in 748ms.

    from enigma import SubstitutedSum, printf
    
    text = 'LGEABHPELA' + 'LGETARLELA' + 'PPEBGXHHPA'
    letters = set(text + '?')
    
    # consider which letter might be wrong
    for (i, x) in enumerate(text):
      # choose an alternate letter
      for y in letters:
        if x == y: continue
        # alter the letter
        t = ''.join((y if j == i else c) for (j, c) in enumerate(text))
        # create the modified sum
        terms = list(t[i:i + 10] for i in (0, 10, 20))
        p = SubstitutedSum(terms[:2], terms[2])
        # and solve it
        for s in p.solve():
          printf("[{i}] {x}->{y} {p.text} / {s}", s=p.substitute(s, p.text))
    

    Solution: The final letter (units digit) in the result is wrong – it should be an L not an A. The correct addition sum then reads 2796085926 + 2794632926 = 5590718852.

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: