Enigmatic Code

Programming Enigma Puzzles

Enigma 1607: England 1, Germany 4

From New Scientist #2772, 7th August 2010 [link]

At the football World Cup in South Africa, the England team lost to Germany 1-4 and so was eliminated from the tournament.

In the equations below, each of the integers 1 to 9 has been replaced consistently by a different letter, in such a way that:

(E×N×G×L×A×N×D) / (G×E×R×M×A×N×Y) = 1 / 4

and

(E+N+G+L+A+N+D) – (G+E+R+M+A+N+Y) = 1 – 4.

What is the numerical value of A+N+G+L+E+D?

[enigma1607]

Advertisements

One response to “Enigma 1607: England 1, Germany 4

  1. jimrandell 4 January 2012 at 4:16 pm

    The following Python program runs in 32ms.

    from itertools import combinations
    from enigma import multiply, irange, printf
    
    # eliminating common terms we get:
    # R+M+Y - L+N+D = 3
    # 4xLxNxD = RxMxY
    
    d1 = set(irange(1, 9))
    for LND in combinations(d1, 3):
      pLND = multiply(LND)
      sLND = sum(LND)
    
      d2 = d1.difference(LND)
      for RMY in combinations(d2, 3):
        pRMY = multiply(RMY)
        sRMY = sum(RMY)
    
        if sRMY - sLND != 3: continue
        if 4 * pLND != pRMY: continue
    
        AGE = d2.difference(RMY)
        sANGLED = sum(AGE) + sLND
    
        printf("LND={LND} pLND={pLND} sLND={sLND} RMY={RMY} pRMY={pRMY} sRMY={sRMY} AGE={AGE} sANGLED={sANGLED}")
    

    Solution: A+N+G+L+E+D = 28.

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: