# Enigmatic Code

Programming Enigma Puzzles

## Enigma 212: More or less right

From New Scientist #1358, 19th May 1983 [link]

I displayed a three-figure number on my calculator. My son looked at the calculator upside-down and said:

“I can see a three-figure number too, and it’s less than yours”.

I added 12 to my number.

“I can still see a number, again less than yours”, he said.

I multiplied my latest number by 6.

“More this time”, he said.

“LESS”, he said, much to my surprise, and then we both laughed.

What number did I originally display?

[enigma212]

### 7 responses to “Enigma 212: More or less right”

1. Jim Randell 6 August 2014 at 8:00 am

My first thought was that LESS, looks suspiciously like 5537 displayed upside down on a 7-segment calculator display.

If this were the case then, working backwards through the problem we get:

5537, displays as “LESS” upside down.

Subtracting 11, gives:

5526, displays as 9255 upside down, and 9255 > 5526.

Dividing by 6, gives:

921, displays as 126 upside down, and 126 < 921.

Subtracting 12, gives:

909, displays as 606 upside down, and 606 < 909.

Solution: The first displayed number was 909 (the right way up).

This Python program looks for sequences that satisfy the conditions up to the final “LESS” statement, and shows there are only three candidate sequences, none of which end up with a number that can be successfully read upside down to give another number. It runs in 34ms.

```# numbers which read as numbers when inverted on a 7-segment display
inverted = { 0: 0, 1: 1, 2: 2, 5: 5, 6: 9, 8: 8, 9: 6 }

# invert a number (sequence of digits)
def invert(s):
try:
return nconcat(inverted[d] for d in s[::-1])
except KeyError:
return None

# choose three digits
for s0 in product(inverted.keys(), repeat=3):
# compute the number the right way up
d0 = nconcat(s0)
# it should be a 3-digit number
if not(99 < d0 < 1000): continue
# and inverted
i0 = invert(s0)
# it should also be a 3-digit number less than d0
if not(99 < i0 < d0): continue

# add 12 to the number
d1 = d0 + 12
# it should still be 3-digits
if not(99 < d1 < 1000): continue
# and invertible
i1 = invert(split(d1, int))
if i1 is None: continue
# i1 should be less than d1
if not(i1 < d1): continue

# multiply by 6
d2 = d1 * 6
# it should be invertible
i2 = invert(split(d2, int))
if i2 is None: continue
# i2 should be more than d2
if not(i2 > d2): continue

d3 = d2 + 11

printf("d0={d0} i0={i0}, d1={d1} i1={i1}, d2={d2} i2={i2}, d3={d3}")
```
• Jim Randell 6 August 2014 at 8:01 am

I recently heard an edition of “Puzzle Panel” on BBC Radio 4 Extra (originally broadcast in July 1998) where Victor Bryant (the real Susan Denham) gave a similar puzzle:

I displayed a number on a calculator. My daughter looked at it upside down and said “I can see a number as well, and it’s more than yours.”

So, I added 3 to my number, and she said “I can still see a number and it’s still more than yours”.

So, I added 3 to my number, and she said “I can still see a number and it’s still more than yours”.

So, I added 3 to my number, and she said “I can still see a number and it’s still more than yours”.

So, I added 3 to my number, and she said “I can still see a number and it’s still more than yours”.

So, I added 13 to my number, and she said “I can still see a number and it’s still more than yours”.

So I added 30, divided by 3, and she said: “Now it’s LESS”.

The answer, of course, being: 5537 × 3 – 30 – 13 – 3 – 3 – 3 – 3 = 16556.

And we can verify that the first 6 inverted numbers are indeed greater than their correctly oriented counterparts.

95591 > 16556, [+3] 65591 > 16559, [+3] 29591 > 16562, [+3] 59591 > 16565, [+3] 89591 > 16568, [+13] 18591 > 16581, [+30] [÷3] 5537.

Victor commented that in the past he had set a puzzle based on this idea and received a letter informing him that “there is no place for trickery in puzzles”.

• Tessa Fullwood 1 September 2014 at 1:59 pm

Without this tip on the trick involved I could only show that numerically there are no solutions given that the only digits I can invert are 0,1, 2, 5, 6, 8, 9.

2. Jackie W 6 November 2014 at 6:29 pm

Congratulations on spotting LESS as a “first thought”. It was very much a last thought for me, when visually inspecting the few possibilities which fell at the final hurdle.