# Enigmatic Code

Programming Enigma Puzzles

## Enigma 1630: Powering up

From New Scientist #2796, 22nd January 2011 [link]

ENIGMA is a number in which the digits are different and non-zero.

ENIGMA is divisible without remainder by E, by the square NI, and by the cube GMA.

What is ENIGMA?

[enigma1630]

Advertisements

### 2 responses to “Enigma 1630: Powering up”

1. jimrandell 13 December 2011 at 11:06 pm

This Python program runs in 30ms.

```from enigma import irange, split, is_distinct, concat, printf

# three digit cubes
for i in irange(5, 9):
GMA = i ** 3
(G, M, A) = split(GMA, int)
if not is_distinct(M, A): continue
if not is_distinct(G, M, A): continue

for j in irange(4, 9):
NI = j ** 2
(N, I) = split(NI, int)
if not is_distinct(N, G, M, A): continue
if not is_distinct(I, N, G, M, A): continue

for E in irange(1, 9):
if not is_distinct(E, N, I, G, M, A): continue
ENIGMA = int(concat(E, N, I, G, M, A))

if ENIGMA % E > 0: continue
if ENIGMA % NI > 0: continue
if ENIGMA % GMA > 0: continue

printf("ENIGMA={ENIGMA} [GMA={GMA} ({i}^3) NI={NI} ({j}^2) E={E}]")
```

Solution: ENIGMA = 349125.

2. geoffrounce 31 January 2015 at 8:31 am

Referring to Hugh’s latest comment on Enigma 254, the description and solution of this puzzle does seem to show a better pattern for the letters used. It also finds the solution in only 17 loops and is based on Jim’s original solution.

```
for E in range(1, 10):
for j in range(4, 10):
NI = j**2
if len(set(str(E) + str(NI))) != 3: continue
for i in range(5, 10):
GMA = i**3
if len(set(str(E)+ str(NI)+ str(GMA)))!= 6: continue
ENIGMA = E*100000 + NI*1000 + GMA
if all(ENIGMA % Z == 0 for Z in (E,NI,GMA)):
print('E={}, NI={}, GMA={}, ENIGMA={}'.format(E,NI,GMA,ENIGMA))
```

Solution: E=3, NI=49, GMA=125, ENIGMA=349125

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