What number is doubled when you move its last digit to the front?
Wednesday 19 August 2026 at 20:05
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 , where is the last digit and the value represented by the remaining digits. For example if the number was 2026 we would have and . Suppose our number has digits.
Then after has been moved to the front its place value will be . The remaining digits will have shifted one place right, so now represent . For example if we apply the process to 2026 we get .
Since the new number is double the original one we can write
which gives . This means the left-hand side must be divisible by 19 and since is a single digit it cannot be a multiple of 19, so must be.
It's not hard to find a suitable value of 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 is 18 so and dividing by 19 gives .
So what is ? If we try setting we get a = 52631578947368421, which doesn't work. Next we try which gives and . Now we have a solution, and it is the smallest possible!
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.
What number is doubled when you move its last digit to the front?
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 , where is the last digit and the value represented by the remaining digits. For example if the number was 2026 we would have and . Suppose our number has digits.
Then after has been moved to the front its place value will be . The remaining digits will have shifted one place right, so now represent . For example if we apply the process to 2026 we get .
Since the new number is double the original one we can write
which gives . This means the left-hand side must be divisible by 19 and since is a single digit it cannot be a multiple of 19, so must be.
It's not hard to find a suitable value of by hand but I was lazy and wrote a short Python program to do the heavy lifting.
This tells us the smallest is 18 so and dividing by 19 gives .
So what is ? If we try setting we get a = 52631578947368421, which doesn't work. Next we try which gives and . Now we have a solution, and it is the smallest possible!
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.