# Enigmatic Code

Programming Enigma Puzzles

## Enigma 1403: X and Y

From New Scientist #2563, 5th August 2006

Professor Exe was surprised to see a common three-letter word written on Professor Wye’s blackboard. Wye explained that it was in fact a three-figure number in base 26, using A=0, B=1, C=2 etc.

So Exe calculated what the number would be in its usual form and then, instead of using the usual digits, he adopted Wye’s notation of A for 0, B for 1, C for 2 etc. Surprisingly he too ended up with a common three-letter word.

What were the two words?

[enigma1403]

### One response to “Enigma 1403: X and Y”

1. Jim Randell 12 August 2013 at 8:18 am

This Python program runs in 37ms.

If you want to use this program you need to provide a file called [[ `enigma1403.txt` ]] with a list of allowable words in. I used a list of 2- and 3-letter words allowed in Scrabble, which gives four solutions, but one of them is most obvious as using two “common” 3-letter words.

```from enigma import irange, int2base, printf

# we need 3-digit numbers in base 10 (so 10^2 to 10^3-1),
# that are also 3-digit numbers in base 26 (26^2 to 26^3-1)
# so from 676 to 999

# allowable 3-letter words
words = set(
w.upper()
for w in l.strip().split()
if len(w) == 3
)

# digits used for base representations
digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

for n in irange(676, 999):
x = int2base(n, base=26, digits=digits)
y = int2base(n, base=10, digits=digits)
if x in words and y in words:
printf("n={n} x={x} y={y}")
```

Solution: The two words are BED and HID (corresponding to 783 in base 26 and base 10 respectively).

The other solutions I got were BEE and HIE (784) – I’ve heard of “hie”, although it’s marked as “archaic” in my dictionary. BAH and GID (683), and BAC and GHI (678) can hardly be described as “common words” (except perhaps to Scrabble aficionados).

This site uses Akismet to reduce spam. Learn how your comment data is processed.