Enigmatic Code

Programming Enigma Puzzles

Enigma 1199: An Enigma’s meaning

From New Scientist #2355, 10th August 2002 [link]

In the numbers ENIGMA, MEANING and IDEA digits have been consistently replaced by letters, with different letters used for different digits. I have tested the numbers 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 and 12 to see if they are a common factor of both ENIGMA and MEANING.

Of course 1 is a common factor of them, and it turns out that nine of the numbers 1-12 are common factors of ENIGMA and MEANING (and indeed the other three numbers are factors of IDEA).

What is the numerical value of ENIGMA?



2 responses to “Enigma 1199: An Enigma’s meaning

  1. Jim Randell 5 October 2015 at 8:40 am

    This brute force approach runs in 721ms.

    from itertools import permutations
    from enigma import nconcat, irange, printf
    digits = set(irange(0, 9))
    divisors = set(irange(2, 12))
    # consider possible assignments for ENIGMA
    for (E, N, I, G, M, A) in permutations(digits, 6):
      if E == 0 or M == 0 or I == 0: continue
      ENIGMA = nconcat(E, N, I, G, M, A)
      MEANING = nconcat(M, E, A, N, I, N, G)
      # find the common divisors
      def common(*ns):
        return set(d for d in divisors if all(n % d == 0 for n in ns))
      # there should be 8 common divisors (excluding 1)
      ds = common(ENIGMA, MEANING)
      if len(ds) != 8: continue
      # the remaining divisors are divisors of IDEA
      rs = divisors.difference(ds)
      # choose D
      for D in digits.difference((E, N, I, G, M, A)):
        IDEA = nconcat(I, D, E, A)
        if not all(IDEA % d == 0 for d in rs): continue
        printf("ENIGMA={ENIGMA} MEANING={MEANING} IDEA={IDEA} {ds} {rs}")

    Solution: ENIGMA = 597240.

    This value of ENIGMA is the only value for which ENIGMA and MEANING share 9 divisors between 1 and 12.

    The shared divisors are: 1, 2, 3, 4, 6, 7, 8, 9, 12.

    Fortunately choosing D = 1 gives IDEA = 7150. Which is divisible by the missing divisors: 5, 10, 11.

  2. arthurvause 7 October 2015 at 11:10 am

    The three numbers not common factors of ENIGMA and MEANING are either
    a) 5,7,10, so 70 doesn’t divide ENIGMA and MEANING but does divide IDEA
    b) 5,10,11 so 110 doesn’t divide ENIGMA and MEANING but does divide IDEA

    In either case A=0, so 10 divides ENIGMA

    so a) 8*9*11*5 divides ENIGMA, 8*9*11 divides MEANING, 70 divides IDEA
    or b) 8*9*7*5 divides ENIGMA, 8*9*7 divides MEANING, 110 divides IDEA

    for enigma_divisor in (8*9*11*5, 8*9*7*5):
      idea_divisor = (8*9*11*5*5*7*2)/enigma_divisor
      for ENIGMA in xrange(enigma_divisor, 1000000, enigma_divisor):
        if len(set(str(ENIGMA)))==6:
          E,N,I,G,M,A = list(str(ENIGMA))
          MEANING = int(M+E+A+N+I+N+G)
          if MEANING%(enigma_divisor/5)==0:
            if any( int(I+D+E+A)%idea_divisor==0 for D in set(str('0123456789'))-set((E,N,I,G,M,A))):
              print "Answer", ENIGMA

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: