OU blog

Personal Blogs

Richard Walker

What number is doubled when you move its last digit to the front?

Visible to anyone in the world
Edited by Richard Walker, Wednesday 19 August 2026 at 22:01

I suppose this must have been solved thousands of times but I wanted to find my own solution,.

I tried with a few 4-digit numbers at first to see if I could get any intuition but without success. I did think of writing a program to do a brute force search for a solution but that felt like cheating. Knowing what I know now it's a good thing I gave up the idea, as you'll see. 

After a lot of thinking I came up with this.

Suppose the number is 10 times a plus b , where b is the last digit and 10 times a the value represented by the remaining digits. For example if the number was 2026 we would have 10 times a equals 2020 and b equals six . Suppose our number has d digits.

Then after b has been moved to the front its place value will be b times .10 super d minus one . The remaining digits will have shifted one place right, so now represent a . For example if we apply the process to 2026 we get 6.10 super four minus one plus 202 equals 6202 .

Since the new number is double the original one we can write

b times .10 super d minus one plus a equals two times left parenthesis 10 times a plus b right parenthesis

which gives b times left parenthesis 10 super d minus one minus two right parenthesis equals 19 times a . This means the left-hand side must be divisible by 19 and since b is a single digit it cannot be a multiple of 19, so 10 super d minus one minus two must be.

It's not hard to find a suitable value of d by hand but I was lazy and wrote a short Python program to do the heavy lifting.

d = 1
while not (10**d - 20) % 19 == 0:
    d = d + 1
print(d)

This tells us the smallest d is 18 so 10 super d minus two equals 999999999999999998 and dividing by 19 gives 52631578947368420 multiplication b equals a .

So what is b ? If we try setting b equals one we get a = 52631578947368421, which doesn't work. Next we try b equals two which gives a equals 105263157894736840 and a plus b equals 105263157894736842 . Now we have a solution, and it is the smallest possible!

210526315789473684 equals two multiplication 105263157894736842

Postscript

I wondered how long the brute force search I contemplated at first would have taken. I worked out a rough estimate and with the standard Python I useit would have been ≅ 1000 years. So I'm glad I didn't try it!

Surprisingly there are hyper-optimised versions of Python that are many orders of magnitude faster and if I had deployed one of these on my Silicon M4 (a technically complex endeavour mind you), it seems I could have found the answer in just under 2 days.

Permalink
Share post