### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

- article (11)
- enigma (1,158)
- misc (2)
- project euler (2)
- puzzle (40)
- site news (44)
- tantalizer (42)
- teaser (3)

### Site Stats

- 178,002 hits

Advertisements

Programming Enigma Puzzles

30 July 2013

Posted by on **From New Scientist #2567, 2nd September 2006**

I have just returned from my summer holidays and am now in a position to confirm what the holiday brochures say – Ibiza is made up of sand, sun, sex and sea! In fact you can see this by setting out the addition sum (below) in which each letter consistently replaces a different digit and the numbers being added are in decreasing order.

What is the value of IBIZA?

[enigma1407]

Advertisements

%d bloggers like this:

This Python program uses the

SubstitutedSum()solver from theenigma.pylibrary (originally written forEnigma 63). It runs in 350ms.Solution:IBIZA = 12183.There are two ways of arriving at the solution as the values for the letters D and X are interchangeable.

Only using the site http://www.iread.it and Excel

SAND+SUN+SEX+SEA=IBIZA

9306+970+954+953=12183

OR

9304+970+956+953=12183

A standard permutation solution:

If you’re interested in a little Python tip you could write the ordering inequality as:

It looks neater, and it may be a tiny bit more efficient.

The ordering inequality suggested looks good for Python, but did not work for me in MiniZinc

Without the ordering inequality, IBIZA can be 10128, 10148, 10168, 10189 or 12183.

Pingback: Enigma 1407: SAND + SUN + SEA + SEX = IBIZA | Ben's Blogs, Books & Pix

This puzzle was also one of the examples I used when writing the generalised Alphametic solver in the

enigma.pylibrary (SubstitutedExpression()). See the articlesSolving Alphametics with PythonandSolving Alphametics with Python, Part 2for more details.Using the command-line invocation we can solve the problem in 391ms. Here is the command and its output: