# Enigmatic Code

Programming Enigma Puzzles

## Enigma 1208: Puzzle panel

From New Scientist #2364, 12th October 2002 [link]

In an edition of BBC Radio 4’s Puzzle Panel the members of the panel were asked to solve the equation A/B + C = D, where A, B, C and D are four different integers, each of which when written as a word consists of five letters. The outrageous answer was 144/12 + 8 = 20, because 144 is a GROSS, 12 is a DOZEN and 20 is a SCORE!

But the puzzle can be solved in a much more conventional and legitimate way if it is set in either French or Italian, even through each language has only five integers that when written as words consist of five letters.

Your task is to write out the numerical version of the equation (as above for the English version) that you would give for (a) the French and (b) the Italian version of the puzzle.

[enigma1208]

### One response to “Enigma 1208: Puzzle panel”

1. Jim Randell 23 August 2015 at 7:59 am

Once you have a the lists of candidate numbers in both languages the programming is straightforward.

This Python program runs in 32ms.

```from itertools import permutations
from enigma import printf

# french integers that are expressed in 5 letters:
# 3 = trois, 12 = douze, 16 = seize, 20 = vingt, 1000 = mille
french = (3, 12, 16, 20, 1000)

# italian integers that are expressed in 5 letters:
# 7 = sette, 10 = dieci, 20 = venti, 100 = cento, 1000 = mille
italian = (7, 10, 20, 100, 1000)

# solve the equation A/B + C = D
def solve(numbers, label):
for (A, B, C) in permutations(numbers, 3):
(x, r) = divmod(A, B)
if r > 0: continue
D = x + C
if D in numbers:
printf("[{label}] {A}/{B} + {C} = {D}")

solve(french, 'French')
solve(italian, 'Italian')
```

Solution: (a) French: 12/3 + 16 = 20; (b) Italian: 1000/100 + 10 = 20.

In words:

French: (DOUZE / TROIS) + SEIZE = VINGT.
Italian: (MILLE / CENTO) + DIECI = VENTI.