# Enigmatic Code

Programming Enigma Puzzles

## Enigma 533: An odd enigma

From New Scientist #1685, 7th October 1989 [link]

In this long division sum, in the dividend and divisor, I’ve replaced digits consistently with letters, with different letters for different digits, and left gaps in all other places where digits should be: You don’t actually need any more clues, but I can tell you that this ENIGMA is odd.

What is this odd ENIGMA?

[enigma533]

### 2 responses to “Enigma 533: An odd enigma”

1. Jim Randell 6 January 2020 at 9:27 am

We can solve this using the [[ `SubstitutedDivision()` ]] solver from the enigma.py library.

The following run file executes in 166ms.

Run: [ @repl.it ]

```#!/usr/bin/env python -m enigma -r

SubstitutedDivision

"ENIGMA / AN = ????"

"ENI - ?? = ??"
"??? - ??? = ??"
"??? - ?? = ??"
"??? - ??? = 0"

# [optional] ENIGMA is odd
--invalid="0|2|4|6|8,A"
```

Solution: ENIGMA = 176249.

2. GeoffR 7 January 2020 at 7:06 pm
```% A Solution in MiniZinc
include "globals.mzn";

%           a b c d               1 8 1 7
%       -----------         -------------
%   A N)E N I G M A      9 7) 1 7 6 2 4 9
%         e f                   9 7
%         -----               -----
%         g h G                 7 9 2
%         i j k                 7 7 6
%         -----                 -----
%           m n M                 1 6 4
%             p q                   9 7
%           -----                 -----
%             r s A                 6 7 9
%             t u v                 6 7 9
%             =====                 =====

var 1..9:E; var 1..9:N; var 0..9:I; var 0..9:G;
var 0..9:M; var 1..9:A;

constraint all_different([E, N, I, G, M, A]);

var 1..9: a;  var 1..9: b; var 1..9: c;  var 1..9: d;
var 1..9: e; var 1..9: f;  var 1..9: g;  var 1..9: h;
var 1..9: i; var 1..9: j;  var 1..9: k;  var 1..9: m;
var 1..9: n; var 1..9: o;  var 1..9: p;  var 1..9: q;
var 1..9: r; var 1..9: s;  var 1..9: t;  var 1..9: u;
var 1..9: v; var 1..9: l;

var 10..99: AN = 10*A + N;
var 1000..9999: abcd = 1000*a + 100*b + 10*c + d;

var 100000..999999: ENIGMA = 100000*E + 10000*N + 1000*I + 100*G + 10*M + A;

% ENIGMA is odd
constraint ENIGMA mod 2 == 1;

var 100..999: ENI = 100*E + 10*N + I;
var 10..99: ef = 10*e + f;
var 10..99: gh = 10*g + h;
var 100..999: ghG = 100*g + 10*h + G;
var 100..999: ijk = 100*i + 10*j + k;
var 10..99: mn = 10*m + n;
var 100..999: mnM = 100*m + 10*n + M;
var 10..99: pq = 10*p + q;
var 10..99: rs = 10*r + s;
var 100..999: rsA = 100*r + 10*s + A;
var 100..999: tuv = 100*t + 10*u + v;

% Partial multiplication and subtraction sums
constraint AN * abcd == ENIGMA;
constraint a * AN == ef /\ ENI - ef == gh;
constraint b * AN == ijk /\ ghG - ijk == mn;
constraint c * AN == pq /\ mnM - pq == rs;
constraint d * AN == tuv /\ rsA - tuv == 0;

solve satisfy;

output ["Sum is = " ++ show(ENIGMA) ++ " / " ++ show(AN)
++ " = " ++ show(abcd) ++ "\n"
++ "ef = " ++ show(ef) ++ " ghG = " ++ show(ghG) ++ "\n"
++ "ijk = " ++ show(ijk) ++ " mnM = " ++ show(mnM) ++ "\n"
++ "pq = " ++ show(pq) ++ " rsA = " ++ show(rsA)
++ " tuv = " ++ show(tuv)  ];

% ENIGMA = 176249 / 97 = 1817
% ef = 97 ghG = 792
% ijk = 776 mnM = 164
% pq = 97 rsA = 679 tuv = 679
% time elapsed: 0.02 s
% ----------
% ==========

```

This site uses Akismet to reduce spam. Learn how your comment data is processed.