# Enigmatic Code

Programming Enigma Puzzles

## Enigma 1770: Power point 2

From New Scientist #2938, 12th October 2013 [link]

I have written a list of five different three-figure numbers, each of which is a power of a single digit. The first number is odd and thereafter each number has the same hundreds digit or the same tens digit or the same units digit as its predecessor.

What (in order) are the five numbers?

This puzzle (apart from a comma) is exactly the same as Enigma 1757.

New Scientist has stated that the puzzle was republished in error.

[enigma1770]

### 4 responses to “Enigma 1770: Power point 2”

1. Jim Randell 9 October 2013 at 6:25 pm

I’m guessing that the difference between this puzzle and Enigma 1757 is supposed to be that instead of saying “The first number is odd”, this puzzle is supposed to say “The first number is even”. If so, a simple change to the code for Enigma 1757 gives a solution to this problem too (although the numbers are just the same as the solution to Enigma 1757, but presented in the reverse order, so it’s not really much of a variation). This Python code runs in 34ms.

```from itertools import count
from enigma import irange, printf

# collect powers of single digits that are 3-digit numbers
powers = set()
for d in irange(2, 9):
for n in count(2):
p = d ** n
if p < 100: continue
if p > 999: break
printf("[{d}^{n} = {p}]")

def solve(ps):
# are we done?
if len(ps) == 5:
print(', '.join(ps))
else:
# extend the sequence with a new power that shares digits with the last
for p in powers:
if p not in ps and any(x == y for (x, y) in zip(p, ps[-1])):
solve(ps + [p])

# and p1 is even
for p1 in powers:
if int(p1) % 2 == 0:
solve([p1])
```

Here is the solution to the suggested variation on Enigma 1757 (although it’s just the same solution as that for Enigma 1757 with the list reversed).

Solution: The five numbers are 512, 216, 256, 243 and 343.

2. arthurvause 10 October 2013 at 8:38 am

The summer weather had started when 1757 was published, so I didn’t have a chance to do it as I had started my walking holidays.

I hope NS aren’t going to repeat all the summer’s puzzles, but as there is another opportunity, here is my solution to 1757 and Jim’s suggested variation that might be 1770.

```candidates = set(str(a**b) for a in xrange(2,10)
for b in xrange(2,10) if 100 <= a**b <= 999)

graph = {x: set(y for y in candidates - set((x,))
if any(y[i]==x[i] for i in range(3)))
for x in candidates}

def extend( path ):
if len(path)==5:
print path
return
for s in graph[path[-1]] - set(path):
extend ( path + [s] )

for c in candidates:
extend( [c] )
```
3. Jim Randell 10 October 2013 at 10:17 am

It’s not the first time the same puzzle has been published twice – back in the early days Enigma 9 later re-appeared as Enigma 83 (and I never found any acknowledgement of the fact in the New Scientist archives). And more recently we’ve had variations on a theme, with Enigma 1740 & Enigma 1755, and also Enigma 1748 & Enigma 1762. The fact that this week’s puzzle is titled “Power point 2” makes me think Enigma 1770 is meant to be one of these variations on a theme.