Riddler Classic
Imagine taking a number and moving its last digit to the front. For example, 1,234 would become 4,123. What is the smallest positive integer such that when you do this, the result is exactly double the original number? (For bonus points, solve this one without a computer.)
Solution
Let the last digit of our mystery number be a, and the rest of it be b. So the number weβre searching for equals 10b+a. Let b be an n-digit number. Then, moving the last digit to the front gives a new number equal to 10nβ
a+b=2(10b+a).
Simplifying that gives (10nβ2)a=19b. For a and b to be integers, we need the left-hand side to be divisible by 19, like the right-hand side is. In other words, we need it to be the case that 10n=2 mod 19.
From Little Fermatβs Theorem we have
1018βΉ2β
1018βΉ20β
1017βΉ1017ββ‘1mod19β‘2mod19β‘2mod19β‘2mod19Β asΒ 20β‘1mod19.β
Therefore the smallest n for which 10n=2 mod 19 is true is n=17.
So we have [(1017β2)/19]β
a=5,263,157,894,736,842β
a=b.