# Enigmatic Code

Programming Enigma Puzzles

## Enigma 1568: Odd puzzle

From New Scientist #2731, 24th October 2009 [link]

In this multiplication sum the digits have been replaced by letters and dots. Different letters stand for different digits, the same letter stands for the same digit, each dot can be any digit, and leading digits cannot be zero. What is the six-figure odd PUZZLE?

[enigma1568]

### 2 responses to “Enigma 1568: Odd puzzle”

1. jimrandell 21 February 2012 at 5:04 pm

The following Python program runs in 55ms.

```from enigma import is_pairwise_distinct, printf

# consider the product that makes ODD
for A in range(100, 1000):
for B1 in range(1, 10):
ODD = str(A * B1)
if len(ODD) != 3: continue
(O, D, D2) = list(ODD)
if D != D2: continue
# then B2 and B3 also make 3 digit products
Bs = list(Bx for Bx in range(0, 10) if len(str(A * Bx)) == 3)
for B2 in Bs:
for B3 in Bs:
B = int(''.join(map(str, (B1, B2, B3))))
PUZZLE = str(A * B)
if len(PUZZLE) != 6: continue

(P,U, Z, Z2, L, E) = list(PUZZLE)
if Z != Z2: continue
if not(int(E) % 2): continue
if not is_pairwise_distinct(P, U, Z, L, E): continue

printf("PUZZLE = {PUZZLE} ({A} x {B}) [ODD = {ODD}]")
```

Solution: PUZZLE = 102235.

2. Jim Randell 23 August 2016 at 10:16 am

Here’s a solution using the general Alphametic solver [[ `SubstitutedExpression()` ]] from the enigma.py library. We introduce new (lower case) symbols that are not required to be distinct from the other symbols to represent the multiplicands of the sum.

The whole thing runs in 111ms. Here is the command and its output:

```% python -m enigma SubstitutedExpression \
--symbols="DELOPUZabcdef" --distinct="DELOPUZ" \