### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

- article (11)
- enigma (1,176)
- misc (2)
- project euler (2)
- puzzle (44)
- site news (46)
- tantalizer (48)
- teaser (3)

### Site Stats

- 183,172 hits

Advertisements

Programming Enigma Puzzles

21 June 2017

Posted by on **From New Scientist #1122, 28th September 1978** [link]

A couple of one’s, a couple of two’s and a six;

All wrong, all wrong!If only I thought that the puzzle was one I could fix,

I’d sing a song.But as I feel sure that it’s rather too much for me,

My voice is muted.Uncle Bungle’s my name and I fear that you must agree,

I’m rather stupid.So please, I implore,

Continue the fight,

With tooth and with claw,

With main and with might,

To make wrong sums right.The figures given are all incorrect. Write out the whole division sum.

[puzzle71]

Advertisements

%d bloggers like this:

Here’s a solution that uses the general alphametic solver (

SubstitutedExpression()) from theenigma.pylibrary.We represent the parts of the diagram as a number of alphametic expressions, and restrict the letters that have digits given from taken on those values.

This run file executes in 103ms.

Solution:The correct sum is: 9828 ÷ 39 = 252.Since

Enigma 389I’ve been thinking about replacing theSubstitutedDivision()solver (originally written forEnigma 206, but used to provide solutions for many other substituted division problems – until I wrote theSubstitutedExpression()solver) with a solver that will turn a long division problem into a set of expressions suitable for feeding to theSubstitutedExpression()solver. I’ve generally found that usingSubstitutedExpression()produces code that executes faster than theSubstitutedDivision()solver, and using theSubstitutedExpression()solver has a lot more bells and whistles than theSubstitutedDivision()solver.I currently have the new

SubstitutedDivision()solver in testing and will roll it out toenigma.pyshortly. While it will handle mostSubstitutedDivision()problems in the same way, there are some cases where a different approach is used with the new solver. Once the new solver is launched I will check my solutions I have previously posted using the old solver and add revised code if necessary.The new implementation of the

SubstitutedDivision()solver is now available in theenigma.pylibrary (version2017-06-21). So this puzzle can be solved by the following run file. It executes in 118ms.I re-used your your letter description of the division puzzle and your solver details to code a full programme solution with a written division sum at the end of the code.