# Enigmatic Code

Programming Enigma Puzzles

## Enigma 1442: Seventy-five

From New Scientist #2603, 12th May 2007

The number 75 is prominent in these three additions, where the undisclosed digits have been replaced by letters and question marks. Different letters represent different digits, and the same letter consistently represents the same digit. A question mark can be any digit, and as usual, leading digits cannot be zero. What number is LESS?

[enigma1442]

### One response to “Enigma 1442: Seventy-five”

1. Jim Randell 9 April 2013 at 9:54 am

The following Python program runs in 45ms.

```from itertools import permutations
from enigma import irange, printf

# possible digits
ds = set(irange(0, 9))

# P, L, I occur as leading digits, and so cannot be zero

# consider the RH 2 columns of sum 2
for (U, S, I) in permutations(ds, 3):
if I == 0: continue
(US, SS, IS) = (U * 10 + S, S * 11, I * 10 + S)
(c2, r) = divmod(95 + US + SS + IS, 100)
if r // 10 != 5: continue
# and the RH 2 columns of sum 3
(c3, r) = divmod(2 * US + IS, 100)
if r > 75: c3 += 1

# consider the LH 2 columns of sum 3
ds1 = ds.difference((U, S, I))
for (P, L) in permutations(ds1.difference([0]), 2):
PL = 10 * P + L
if 75 + 2 * PL + c3 > 99: continue

# compute the carry from the RH 2 columns of sum 1
c1 = (225 + US + SS + IS) // 100
# consider the LH 2 columns of sum 1
ds2 = ds1.difference((P, L))
for E in ds2:
LE = L * 10 + E
if 37 + PL + LE + c1 > 75: continue

LESS = LE * 100 + SS
printf("LESS={LESS} [U={U} S={S} I={I} P={P} L={L} E={E}]")
```

Solution: LESS = 2399.

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