# Enigmatic Code

Programming Enigma Puzzles

## Enigma 1292: Naturellement

From New Scientist #2450, 5th June 2004 [link]

Susan Denham‘s recent Enigma “Natural Numbers” prompted me to look for a French version. Once again I have assigned a number to each letter of the alphabet and the numbers, which are not all different, include negative numbers, zero, positive numbers and fractions.

I can tell you that:

U + N = 1
D + E + U + X = 2
T + R + O + I + S = 3
Q + U + A + T + R + E = 4
C + I + N + Q = 5
S + I + X = 6
S + E + P + T = 7
H + U + I + T = 8
N + E + U + F = 9
D + I + X = 10
O + N + Z + E = 11
D + O + U + Z + E = 12
T + R + E + I + Z + E = 13
Q + U + A + T + O + R + Z + E = 14
Q + U + I + N + Z + E = 15

Please send in S + A + I + N + T + T + R + O + P + E + Z.

Note: I am waiting for a phone line to be connected at my new house, so I only have sporadic access to the internet at the moment. The current estimate is that the line will be connected at the end of September 2014.

[enigma1292]

### 4 responses to “Enigma 1292: Naturellement”

1. Jim Randell 19 September 2014 at 6:25 pm

I used the SymPy symbolic maths library to solve the simultaneous equations for me.

This Python program runs in 487ms.

```from sympy import symbols, Eq, solve
from enigma import printf

(U, N, D, E, X, T, R, O, I, S, Q, A, C, P, H, F, Z) = symbols(tuple('UNDEXTROISQACPHFZ'))

eqs = (
Eq(U + N, 1),
Eq(D + E + U + X, 2),
Eq(T + R + O + I + S, 3),
Eq(Q + U + A + T + R + E, 4),
Eq(C + I + N + Q, 5),
Eq(S + I + X, 6),
Eq(S + E + P + T, 7),
Eq(H + U + I + T, 8),
Eq(N + E + U + F, 9),
Eq(D + I + X, 10),
Eq(O + N + Z + E, 11),
Eq(D + O + U + Z + E, 12),
Eq(T + R + E + I + Z + E, 13),
Eq(Q + U + A + T + O + R + Z + E, 14),
Eq(Q + U + I + N + Z + E, 15),
)

for s in solve(eqs, dict=True):
r = 0
for x in (S, A, I, N, T, T, R, O, P, E, Z):
v = s.get(x, x)
printf("[{x} = {v}]")
r += v
printf("S + A + I + N + T + T + R + O + P + E + Z = {r}")
```

Solution: S + A + I + N + T + T + R + O + P + E + Z = 33.

We can’t work out the actual values of all the letters, but we can determine their values in terms of T and Z.

In the required sum the coefficients of T and Z turn out to be zero, so the numerical value of the sum can be calculated.

2. Jim Randell 16 November 2014 at 4:15 pm

Here’s an LP solution using the same PyMathProg code I used for Enigma 1278. It runs in 52ms.

```import pymprog
from collections import Counter
from enigma import printf

# the equations
eqs = {
'UN': 1,
'DEUX': 2,
'TROIS': 3,
'QUATRE': 4,
'CINQ': 5,
'SIX': 6,
'SEPT': 7,
'HUIT': 8,
'NEUF': 9,
'DIX': 10,
'ONZE': 11,
'DOUZE': 12,
'TREIZE': 13,
'QUATORZE': 14,
'QUINZE': 15,
}

# labels for the equations (in a sensible order)
KEYS = sorted(eqs.keys(), key=lambda k: eqs[k])

# count the letters in each equation
n = dict((k, Counter(k)) for k in KEYS)

# target
t = Counter('SAINTTROPEZ')

# create the model
p = pymprog.model('enigma1292')

# find a multiplier for each equation
x = p.var(KEYS, 'x', float, bounds=(None, None))

# constraints (one for each letter)
for k in sorted(set().union(*KEYS)):
printf("[letter = {k}, target = {t}]", t=t[k])
p.st(sum(x[i] * n[i][k] for i in KEYS) == t[k])

# solve the problem
p.solve(float)
printf("[solver status = {s}]", s=p.status())

r = 0
for k in KEYS:
m = float(x[k].primal)
v = eqs[k]
printf("[equation: {k} = {v}, multiplier = {m}]")
r += m * v
printf("result = {r}")
```

The multipliers it finds are:

(3/2)×[1] – 2×[2] – (1/2)×[3] + (1/2)×[4] + (1/2)×[6] + [7] + (3/2)×[10] + (1/2)×[11] + (1/2)×[12] + (1/2)×[13] + (1/2)×[14] – [15] = 33.

3. Hugh Casement 26 November 2014 at 10:04 am

The French for 13 is treize. I know it makes no difference to the letters count, but I still think words should be correctly spelled.

• Jim Randell 26 November 2014 at 10:08 am

Oops! There is a mistake in the transcription. It was published correctly in the magazine. I’ve now corrected it.

Thanks for pointing out the mistake.