Enigmatic Code

Programming Enigma Puzzles

Enigma 1493: A simple multiplication

From New Scientist #2655, 10th May 2008

In the multiplication shown below, the digits have been replaced by letters and asterisks. Different letters stand for different digits, the same letter stands for the same digit, an asterisk can be any digit, and leading digits cannot be zero.

Enigma 1493

What is the six-figure product?



3 responses to “Enigma 1493: A simple multiplication

  1. Jim Randell 12 November 2012 at 3:18 pm

    The following brute-force approach in Python runs in 371ms.

    from enigma import irange, printf
    for a in irange(100, 999):
      for b in irange(100000 // a, 999):
        c = str(a * b)
        # c should be 6-digit
        if len(c) > 6: break
        # and all digits should be different
        if len(set(c)) != 6: continue
        # determine the intermediate products
        c1 = str(a * (b % 10))
        if len(c1) != 3: continue
        c2 = str(a * ((b // 10) % 10))
        if len(c2) != 3: continue
        # both should start with 'S'
        if c2[0] != c[0]: continue
        # and 'O' should be different from the other letters
        if c2[1] == c2[0] or c2[1] in c: continue
        c3 = str(a * (b // 100))
        if len(c3) != 3: continue
        printf("{a} x {b} = {c} [{c1} + {c2}0 + {c3}00]")

    Solution: The final six-digit product is 102485.

  2. Naim Uygun 12 November 2012 at 4:38 pm
    for x in range(100,1000):
        for y in range(100,1000):
            if len(set(simple)) != 6 : continue
            if yc*x>999: continue
            if so>999: continue
            if ya*x>999: continue
            if simple[0] != str(so)[0]: continue
            print(x," x ",y," = ",n)
  3. Jim Randell 5 August 2017 at 10:32 pm

    Here’s a solution using the SubstitutedExpression() solver from the enigma.py library. We introduce additional lower case letters to stand for the asterisks in the diagram.

    The following run-file executes in 147ms.

    #!/usr/bin/env python -m enigma -r
    #     abc
    #  x  def
    #  ------
    #     ghi
    #    SOj
    #  klm
    #  ------
    #  SIMPLE
    #  ======
    "abc * def = SIMPLE"
    "abc * f = ghi"
    "abc * e = SOj"
    "abc * d = klm"

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: