# Enigmatic Code

Programming Enigma Puzzles

## Enigma 309: Missing letters

From New Scientist #1457, 23rd May 1985 [link]

In the following division sum, some of the digits are missing and some are replaced by letters. The same letter stands for the same digit whenever it appears, and different letters stand for different digits.

Find the correct sum.

This puzzle brings the total number of Enigma puzzles on the site to 890. Since the final puzzle was Enigma 1780 you might expect that we now have 50% of all Enigma puzzles ever published available in the archive. However since there are sometimes multiple puzzles published with the same number (typically at Christmas) I don’t think we’re quite there yet. But I’ll be marking the “half-way” milestone sometime next week.

[enigma309]

### 9 responses to “Enigma 309: Missing letters”

1. Jim Randell 10 September 2015 at 8:20 am

This is exactly the kind of problem I wrote the SubstitutedDivision() solver in the enigma.py library for. This Python program runs in 159ms.

```from enigma import SubstitutedDivision

# copy the g from the third intermediate sum up into the dividend
SubstitutedDivision(
'h???g?', '??', 'm?gh',
[('g??', '??'), ('ky?', '?'), ('m?', 'x'), ('??', '')]
).go()
```

Solution: There correct sum is 202616 ÷ 43 = 4712.

Note: Originally I published a program that found 10 solutions to the sum, but this was because the solver is not given the first line of the intermediate subtraction sums to check, so it failed to check the g in the third intermediate sum. I shall update the solver so that the entire intermediate sum can be checked.

2. Hugh Casement 10 September 2015 at 10:22 am

In the version in my files, the dividend has the G in the tens place.
Not sure whether I found it in the NS archive or on Google Books.

• Jim Randell 10 September 2015 at 10:35 am

I used the Google Books archive as the source for this puzzle [ https://books.google.co.uk/books?id=l2o3GceSPyAC&lpg=PP1&pg=PA46#v=onepage&q&f=false ] (I also reference my source for the puzzles via the [link] after the New Scientist issue number and date).

Perhaps a correction was published, but I didn’t find it when I looked.

• Julian Gray 12 September 2015 at 9:53 am

Referring to Hugh’s note above, in the puzzle text, “g” is shown in the line below “ky-“. Doesn’t that mean the “g” is automatically the tens digit in the dividend?

• Jim Randell 12 September 2015 at 10:02 am

Of course, you are right. Sadly this means there must be a mistake in my solver because some of the solutions it comes up with have two different values for g. I shall investigate it.

• Jim Randell 12 September 2015 at 10:13 am

Ah, I see. It’s because my program doesn’t look at the first line of the intermediate subtraction sums (they are not even given to it to look at), so it’s missing checking the g in the third intermediate sum (?g − m? = x), and that’s why it comes up with multiple solutions, but if you copy the g up into the dividend it finds the unique solution.

I’ve removed the “flawed” tag and I’ll update my original comment above.

• Julian Gray 12 September 2015 at 4:29 pm

Good luck with that and here’s encouraging you to keep passing the milestones – my retirement is mentally energised HUGELY by your Enigmas. I happily do all of them without the help of Python – Excel is wonderfully useful.

• Hugh Casement 13 September 2015 at 6:33 pm

Julian, I’ll echo your comment about the mental stimulus Jim provides for us retired people. And you’ve solved the puzzle of where I got that missing letter. Easy to overlook the obvious!

Hope I can be forgiven for mentioning ST Teaser no. 2762 out of context. The solution is rather well hidden on Brian’s web site (amongst the discussion of other possible or improbable polyhedra). I knew it had to be 9, 9, 16 (Danke, Herr Euler!), but couldn’t see how to fit the faces together. There’s an octagonal top, each edge shared with one triangular face, the opposite vertices of those eight triangles all meeting at a point at the base of the gemstone.

• Jim Randell 15 September 2015 at 2:31 pm

In the 2015-09-15 version of the enigma.py library you can optionally fully specify the intermediate sums when calling the SubstitutedSum() solver, and it will check them against the specified dividend and modify it accordingly.

The following program uses fully specified intermediates, and finds the unique answer.

```from enigma import SubstitutedDivision

SubstitutedDivision(
'h?????', '??', 'm?gh',
[('h??', 'g??', '??'), ('???', 'ky?', '?'), ('?g', 'm?', 'x'), ('x?', '??', '')]
).go()
```

Although it’s not necessary to fully specify intermediates that don’t add any new information. So we can just fully specify the third intermediate sum, and get the same result.

```from enigma import SubstitutedDivision

SubstitutedDivision(
'h?????', '??', 'm?gh',
[('g??', '??'), ('ky?', '?'), ('?g', 'm?', 'x'), ('??', '')]
).go()
```

Or you can manually copy up the information into the dividend directly and use SubstitutedSum() as before. (This is the same as the program given in my original comment).

```from enigma import SubstitutedDivision

SubstitutedDivision(
'h???g?', '??', 'm?gh',
[('g??', '??'), ('ky?', '?'), ('m?', 'x'), ('??', '')]
).go()
```