Enigmatic Code

Programming Enigma Puzzles

Enigma 1457: Anglo-Italian sums

From New Scientist #2618, 25th August 2007

Within each of these Anglo-Italian sums, digits have been consistently replaced by capital letters, different letters used for different digits. However, the three sums are entirely distinct — a letter need not have the same value in one as in either of the others. No number starts with a zero.

(a) FOUR + FOUR = OTTO
(b) TWO + TRE + FIVE = DIECI
(c) THREE + NOVE = DODICI

What are the numbers represented by OTTO in (a), DIECI in (b), DODICI in (c)?

[enigma1457]

Advertisements

3 responses to “Enigma 1457: Anglo-Italian sums

  1. Jim Randell 28 February 2013 at 9:46 am

    This Python program uses the SubstitutedSum() solver from the enigma.py library. It ouputs the possible solutions for each sum, and counts the number of solutions for each answer. It runs in 276ms.

    Run: [ @repl.it ]

    from collections import Counter
    from enigma import SubstitutedSum, printf
    
    sums = (
      # (a) FOUR + FOUR = OTTO
      SubstitutedSum(['FOUR'] * 2, 'OTTO'),
      # (b) TWO + TRE + FIVE = DIECI
      SubstitutedSum(['TWO', 'TRE', 'FIVE'], 'DIECI'),
      # (c) THREE + NOVE = DODICI
      SubstitutedSum(['THREE', 'NOVE'], 'DODICI')
    )
    
    r = Counter()
    for (n, p) in zip('abc', sums):
      for s in p.solve():
        r[p.result + '=' + p.substitute(s, p.result)] += 1
        printf("({n}) {p.result}={r} [{p.text} / {s}]", r=p.substitute(s, p.result), s=p.substitute(s, p.text))
    
    for (k, v) in r.items():
      printf("{k} [{v} solutions]")
    

    Solution: (a) OTTO = 2552; (b) DODICI = 101626; (c) DIECI = 10730.

    • Naim Uygun 28 February 2013 at 11:21 am

      By using the site http://www.iread.it
      Here are the results:
      FOUR+FOUR=OTTO:
      R O F U T
      6 2 1 7 5

      TWO+TRE+FIVE=DIECI:
      O E I T W R F V D C
      6 7 0 8 5 4 9 2 1 3
      6 7 0 8 4 5 9 2 1 3
      6 7 0 8 5 2 9 4 1 3
      6 7 0 8 2 5 9 4 1 3
      6 7 0 8 4 2 9 5 1 3
      6 7 0 8 2 4 9 5 1 3

      THREE+NOVE=DODICI:
      E I T H R N O V D C
      8 6 9 7 5 4 0 3 1 2
      8 6 9 4 5 7 0 3 1 2

  2. geoffrounce 13 November 2017 at 5:58 pm

    Another SustitutedSum version showing all solutions.

    from enigma import SubstitutedSum as Sum
    
    Sum(['FOUR', 'FOUR'], 'OTTO').go()          # (a) OTTO = 2552
    
    Sum(['TWO', 'TRE', 'FIVE'], 'DIECI').go()   # (b) DIECI = 10730
    
    Sum(['THREE', 'NOVE',], 'DODICI').go()      # (c) DODICI = 101626 
    
    '''
    OUTPUT
    ------
    FOUR + FOUR = OTTO
    1276 + 1276 = 2552 / F=1 O=2 R=6 T=5 U=7
    
    TWO + TRE + FIVE = DIECI
    826 + 847 + 9057 = 10730 / C=3 D=1 E=7 F=9 I=0 O=6 R=4 T=8 V=5 W=2
    826 + 857 + 9047 = 10730 / C=3 D=1 E=7 F=9 I=0 O=6 R=5 T=8 V=4 W=2
    846 + 827 + 9057 = 10730 / C=3 D=1 E=7 F=9 I=0 O=6 R=2 T=8 V=5 W=4
    846 + 857 + 9027 = 10730 / C=3 D=1 E=7 F=9 I=0 O=6 R=5 T=8 V=2 W=4
    856 + 827 + 9047 = 10730 / C=3 D=1 E=7 F=9 I=0 O=6 R=2 T=8 V=4 W=5
    856 + 847 + 9027 = 10730 / C=3 D=1 E=7 F=9 I=0 O=6 R=4 T=8 V=2 W=5
    
    THREE + NOVE = DODICI
    94588 + 7038 = 101626 / C=2 D=1 E=8 H=4 I=6 N=7 O=0 R=5 T=9 V=3
    97588 + 4038 = 101626 / C=2 D=1 E=8 H=7 I=6 N=4 O=0 R=5 T=9 V=3
    '''
    

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 )

w

Connecting to %s

%d bloggers like this: