Enigmatic Code

Programming Enigma Puzzles

Enigma 1471: Hidden values

From New Scientist #2632, 1st December 2007

In this puzzle, each letter has a value of a positive whole number. A letter has its own same value throughout, but different letters do not necessarily have different values.

For example, all the vowels have value 1, but all the consonants have values greater than 1. Only one letter has a value of 10 or more.

Given any word it is possible to calculate its value by adding up the values of the individual letters. The words ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, LOTS have different values (all 20 or less) and these words are in increasing order of their values.

Find the value of VALUES.

[enigma1471]

Advertisements

One response to “Enigma 1471: Hidden values

  1. Jim Randell 22 January 2013 at 1:00 pm

    If turns out there’s only one possible value for N which means that ONE, TWO, …, NINE are consecutive numbers from ONE=10 to NINE=18. With this little bit of analysis you get a reasonably compact Python program. It runs in 34ms.

    from enigma import irange, printf
    
    A = E = I = O = U = 1
    
    # ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, LOTS are in
    # increasing order and LOTS is 20 or less, so the max value of ONE is 11,
    # max for TWO is 12, etc.
    
    # so the max value of NINE is 19, so max value of 2N is 17, so N <= 8
    # and defining N also gives us the value of ONE
    
    # as there are 8 values between ONE and NINE it follows: NINE - ONE >= 8
    # so: 2N + 2 - (N + 2) >= 8, i.e. N >= 8
    
    # hence N = 8
    N = 8
    
    # and that means the values are consecutive integers from ONE=10 to NINE=18
    (TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT) = (11, 12, 13, 14, 15, 16, 17)
    
    for T in irange(2, TWO - (2 + O)):
      W = TWO - (T + O)
    
      for H in irange(2, THREE - (T + 2 + E + E)):
        R = THREE - (T + H + E + E)
        F = FOUR - (O + U + R)
        V = FIVE - (F + I + E)
        S = SEVEN - (E + V + E + N)
        X = SIX - (S + I)
        G = EIGHT - (E + I + H + T)
    
        # and LOTS is 19 or 20
        for LOTS in (19, 20):
          L = LOTS - (O + T + S)
    
          # find consonants not in the range 2 - 9
          s = list(x for x in (N, T, W, H, R, F, V, S, X, G, L) if not(1 < x < 10))
          if len(s) != 1: continue # there should be only one
          if not(s[0] > 9): continue # and it should be 10 or more
    
          VALUES = V + A + L + U + E + S
    
          printf("VALUES={VALUES} [LOTS={LOTS} N={N} T={T} W={W} H={H} R={R} F={F} V={V} S={S} X={X} G={G} L={L}]")
    

    Solution: VALUES = 18.

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: