Enigmatic Code

Programming Enigma Puzzles

Enigma 149: A base problem

From New Scientist #1294, 25th February 1982 [link]

Enigma 149
The answer to each of the subtraction sums in the above is the same positive number. Each letter stands for a different digit between 1 and 9 inclusive: none stands for zero.

Notice that I have not said that the numbers are expressed to the base 10. But they are all to the same base.

What is ICER in digits? And what is the base?


On 30th November 2011 (two years ago) I set up this site for sharing programmed solutions to Enigma puzzles. I started off with 5 puzzles from November 2011. Now there are 561 puzzles available on the site, including a complete archive of puzzles from December 2005 to date (8 years of puzzles), as well as the first 149 puzzles from the start of Enigma (February 1979 to February 1982 – 3 years of puzzles). All together the site currently covers 31.6% of all the Enigma puzzles published, and I’ll carry on putting up old and new puzzles as long as I can source them.


4 responses to “Enigma 149: A base problem

  1. Jim Randell 30 November 2013 at 8:45 am

    There are 4 different digits, so the smallest they can be is 1 to 4 in base 5, so we consider bases starting at 5. This Python program runs in 36ms.

    from itertools import count, combinations
    from enigma import irange, nconcat, printf
    # we note that I > R > E > C, and itertools.combinations generates ordered sub-sequences
    def solve(b):
      for (C, E, R, I) in combinations(irange(1, min(b - 1, 9)), 4):
        ICER = nconcat(I, C, E, R, base=b)
        RICE = nconcat(R, I, C, E, base=b)
        ERIC = nconcat(E, R, I, C, base=b)
        CERI = nconcat(C, E, R, I, base=b)
        x = ICER - RICE
        y = RICE - ERIC
        z = ERIC - CERI
        if x == y == z:
          printf("base={b}: {ICER} - {RICE} = {x}, {RICE} - {ERIC} = {y}, {ERIC} - {CERI} = {z}")
          yield (C, E, R, I)
    # find the first base with solutions
    for b in count(5):
      r = list(solve(b))
      if not r: continue
      for (C, E, R, I) in r:
        printf("ICER={I}{C}{E}{R} [base={b}]")

    Solution: The sums are expressed in base 9. ICER = 8135 in base 9 (which is 5945 in decimal).

  2. Naim Uygun 30 November 2013 at 10:43 am
    icer= 1 8 6 4 rice= 4 1 8 6 eric= 6 4 1 8 ceri= 8 6 4 1  base= 9
    icer= 8 1 3 5 rice= 5 8 1 3 eric= 3 5 8 1 ceri= 1 3 5 8  base= 9
    from itertools import permutations
    for i,c,e,r in permutations(range(1,10),4):
        for t in range(5,10):
            if t <= max(i,c,e,r):continue
            if (icer-rice)==(rice-eric)==(eric-ceri):
                print("icer=",i,c,e,r,"rice=",r,i,c,e, "eric=",e,r,i,c,"ceri=",c,e,r,i," base=",t)
  3. Naim Uygun 30 November 2013 at 3:00 pm

    Congratulations to you, Jim, for completing two years on this site, today.
    I wish you continued success in your Python programming career.
    Greetings from Istanbul, Turkey.

  4. Jim Olson 30 November 2013 at 11:37 pm

    Great site both fun and educational.

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: