### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

- article (11)
- enigma (1,367)
- misc (4)
- project euler (2)
- puzzle (90)
- puzzle# (48)
- site news (58)
- tantalizer (94)
- teaser (7)

### Site Stats

- 233,129 hits

Programming Enigma Puzzles

5 August 2019

Posted by on **From New Scientist #1663, 6th May 1989** [link]

I wrote an odd number on the board and asked the class how many numbers (including the original number itself) could be made by writing exactly the same digits but in different orders. (For example, if the number had been 5051, the answer would have been nine, namely 5051, 5015, 5105, 5150, 5501, 5510, 1055, 1505 and 1550).

Clever Dick got the right answer immediately, so to keep him busy I told him to repeat the exercise with exactly double my original number.

“That just doubles the number of ways, Miss,” he reported.

I told him to double again and repeat the exercise, and again he reported “That doubles the number of ways yet again, Miss.”

So I told him to double the number yet again and to repeat the exercise with the four-figure answer.

“It’s doubled the number of ways

again, Miss,” he replied and, as always, he was quite right.What number did I write on the board?

[enigma511]

%d bloggers like this:

This Python program constructively examines the number of arrangements of possible numbers.

It runs in 111ms.

Run:[ @repl.it ]Solution:The starting number was 447.A 3-digit number with all digits non-zero and different has

3! = 6rearrangements.If two of the digits are the same, this number is halved to give 3 arrangements.

Similarly, a 4-digit number with all digits non-zero and different has

4! = 24rearrangements.Again, if two of the digits are the same, this number is halved to give 12 arrangements.

So starting with 447 and doubling we get:

The corresponding numbers of arrangements of the digits are:

If we continue to double we get 7512, which again has 24 arrangements. But doubling again to 14304 yet again doubles the number of arrangements, having 48.