# Enigmatic Code

Programming Enigma Puzzles

## Enigma 33: Discovery

From New Scientist #1175, 4th October 1979 [link]

Letters stand for digits, but who knows what stands for what?
You’ve got to use your wits and thus decide.
Different letters, different digits, for I’ve got,
As maker of the puzzle, proper pride.

E and R and I and C, that makes a name,
And the second line is similar,
With 2 letters familiar
For E and R, read I and P, and then the same.
With an R and a V and a couple of E‘s,
The sum is completed, but please
Do you add or subtract? That’s for you to discover
If the one can’t be done, then it must be the other.

Do you add or subtract? Write the sum out with the numbers substituted for letters.

This is the 300th Enigma puzzle posted to the site (that’s 17.3% of all Enigmas published).

[enigma33]

### 5 responses to “Enigma 33: Discovery”

1. Jim Randell 6 January 2013 at 1:54 pm

The following Python program runs in 114ms.

```from itertools import permutations
from enigma import irange, nconcat, printf

ds = set(irange(0, 9))
for (E, R, I, C, P) in permutations(ds, 5):
if 0 in (E, I): continue
ERIC = nconcat(E, R, I, C)
IPIC = nconcat(I, P, I, C)

# accumulate working results
rs = []
for f in (1, -1):
r = ERIC + f * IPIC
(V, m) = divmod(r - (1000 * R + 11 * E), 100) # compute V
if m > 0 or V not in ds: continue # r doesn't look like RVEE
if V in (E, R, I, C, P, r % 10): continue # check V
rs.append(f)
# we want exactly one of the operators to work
if len(rs) != 1: continue
f = rs[0]
printf("{ERIC} {fn} {IPIC} = {r}", fn='-?+'[f + 1], r=ERIC + f * IPIC)
```

Solution: The sum is 2861 + 6061 = 8922.

2. Naim Uygun 6 January 2013 at 4:38 pm

Hi Jim,

I solved this enigma using the site:
I wish you a happy new year.

ERIC – IPIC = RVEE
No solution!

ERIC + IPIC = RVEE
C E R I P V
1 2 8 6 0 9

3. Elizabeth Fullwood 7 January 2013 at 9:34 pm

You are dong a good job there. I could do this one by having a look at it!

4. Jim Randell 8 January 2013 at 12:43 pm

Using the substituted sum solver I recently added to the enigma.py module, this puzzle can be solved by the following Python code in 42ms.

```from enigma import SubstitutedSum, printf

# the sums to try
sums = {
'ERIC + IPIC = RVEE': SubstitutedSum(['ERIC', 'IPIC'], 'RVEE'),
'ERIC - IPIC = RVEE': SubstitutedSum(['IPIC', 'RVEE'], 'ERIC')
}

for (text, p) in sums.items():
for r in p.solve():
s = p.substitute(r, text)
printf("[{text}] {s}")
```
5. geoffrounce 1 August 2016 at 9:36 am
```% A solution in MiniZinc
include "globals.mzn";

var 0..9: E;
var 0..9: P;
var 0..9: I;
var 0..9: C;
var 0..9: R;
var 0..9: V;

var 1000..9999: ERIC = 1000*E + 100*R + 10*I + C;
var 1000..9999: IPIC = 1000*I + 100*P + 10*I + C;
var 1000..9999: RVEE = 1000*R + 100*V + 10*E + E;

constraint all_different([E,P,I,C,R,V]) /\ E>0 /\ I>0 /\ R>0;

constraint (ERIC + IPIC == RVEE) \/ (ERIC - IPIC == RVEE);

solve satisfy;

output[ "ERIC : " ++ "    " ++ show(ERIC)  ++
"\nIPIC :" ++ "(+/-)" ++ show(IPIC) ++
"\nRVEE : " ++ " =  " ++ show(RVEE)];