### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

- article (11)
- enigma (1,149)
- misc (2)
- project euler (2)
- puzzle (38)
- site news (44)
- tantalizer (40)
- teaser (3)

### Site Stats

- 175,242 hits

Advertisements

Programming Enigma Puzzles

26 June 2012

Posted by on **From New Scientist #2698, 7th March 2009** [link]

Joe has found that just a few numbers have a rather unique property. Reverse the order of the digits, and the new number is a multiple of the original. For some specified numbers of digits (four or more) there are only two numbers with the property.

Joe gave Penny the task of finding the two 6-digit numbers.

What is the lower 6-digit number?

[enigma1535]

Advertisements

%d bloggers like this:

Here’s my original Perl code. It’s pretty straightforward and runs in 11ms.

Solution:The lower number is 109989.If you leave the program to run to completion (by removing the

laststatement), you also find that 219978 is the other possible answer.And here’s the same thing in Python. It runs in 51ms.