Enigmatic Code

Programming Enigma Puzzles

Enigma 83: More letters for digits

From New Scientist #1226, 6th November 1980 [link]

Uncle Bungle has been doing a division sum with letters substituted for digits. Was it by accident or design, I wonder, that he left out the divisor?

What was left looked like this:

Enigma 83

Find the divisor and all the digits of the sum.

This puzzle is not only similar to Enigma 9, it is exactly the same puzzle.


One response to “Enigma 83: More letters for digits

  1. Jim Randell 23 April 2013 at 8:00 am

    This puzzle is exactly the same as Enigma 9, so I thought I’d try a different approach to normal (see Enigma 80 and all the puzzles mentioned in my solution for my more usual approach) and used the [[ SubstitutedSum() ]] solver (from the enigma.py library) to attack it. It’s not the fastest way, but there are only three candidate solutions that make it through the initial check, and two of those are removed by the first check on the intermediate values, but I went ahead and put the checks in for all of the intermediate values to make sure the only viable solution is indeed correct. This Python program runs in 1.1s.

    from enigma import irange, SubstitutedSum, printf
    # the divisor B is at most a 2-digit number as r x B = bp
    for B in irange(2, 98):
      P = SubstitutedSum(['rypyqz'] * B + ['d'], 'bdaypzb', d2i={0: 'rbpxyd'})
      for S in P.solve():
        # check the intermediate values
        (y, r, p, d) = (S[X] for X in 'yrpd')
        (bp, bd, pa, yrd, qz, rdd, rzb) = (int(P.substitute(S, X)) for X in ('bp', 'bd', 'pa', 'yrd', 'qz', 'rdd', 'rzb'))
        # x only occurs in the intermediate values
        # so compute it, and make sure it doesn't hit any existing values
        x = (y * B) // 10
        if x == 0 or x in S: continue
        (xr, yx, yxy, xp) = (10 * x + r, 10 * y + x, 101 * y + x * 10, 10 * x + p)
        # now check all the intermediate values
        if not all((
          r * B == bp,
          bd - bp == p,
          y * B == xr,
          pa - xr == yx,
          p * B == yrd,
          yxy - yrd == x,
          xp - xr == r,
          qz * B == rdd,
          rzb - rdd == d,
        )): continue
        printf("{A} / {B} = {D} r {d}", A=P.substitute(S, P.result), D=P.substitute(S, P.terms[0]))

    Solution: The correct sum is 6851496 ÷ 32 = 214109 remainder 8.

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: