In an New York Times Magazine article on Freeman Dyson, the following problem is posed:
Does there exist a natural number in base 10 where if you move the last digit to the front, e.g. transfrom 12345 to 51234, the new number is exactly twice of its original?Dyson allegedly solved it in an instant, without using pencil and paper.
Here's a quick derivation of how Dyson came up with the answer that the smallest such number is 18 digits long:
Write the number as 10x + b. x represents the left-most k digits of the original number. Then the equation to solve is
2(10x + b) = 10k b + xfor some unknown k. This simplifies to
19 x = (10k - 2) bSince b is a digit, 19 cannot divide it. This means 19 divides (10k - 2), or that
10k = 2 mod 19Divide both sides by 2, we have
5 * 10k-1 = 1 mod 19Since 19 is prime, it follows that 1018 = 1 mod 19. On the other hand, observe that
102 = 100 = 5 + 95 = 5 mod 19So that in modular arithmetics, we have
102 * 10k-1 = 1018 mod 19which says that k = 18n - 1, for some integer n. The smallest positive k then is 17. So the number must be 18 digits long (it has 17 digits in front and a single digit b in the end).
What is this number exactly? We want to solve
(1017b - 2)b = 19 xwith the requirement that x is 17 digits long. A simple calculation shows that this means
x = 5263157894736842 bThe coefficient being 16 digits long. So for any digit 1 < b < 10, we get a solution. And the smallest positive solution to the original problem is 105263157894736842, with b = 2.
We can also ask this problem more generally:
Does there exist a positive integer when expressed in base N such that moving its right-most digit to the left makes it n times larger?It is clearn that a solution can only possibly exist if n < N. The equation we wrote down above now has the general form
(Nk - n)b = (nN - 1) xIn the case n = 1, the solution is trivial: for any positive integer k, the polynomial (N-1) is a factor for the polynomial (Nk-1), the by examine the polynomial dividend, it is clear that all the solutions are given by repeating the same digit a certain number of times.
For the case n > 1, then for a non trivial base N > 1 (in base one there is only 1 mit (as in bit/digit for binary/decimal systems), so the problem is trivial),
nN - 1 = (n-1)N + N - 1 > NSo it cannot divide b.
If nN - 1 happens to be prime, then it must then divide Nk - n, or
Nk = n mod (nN - 1)which is an easily solvable equation as long as nN - 1 is prime.
Whether the most general case can be resolved is an exercise in abstract algebra and number theory that I am not sure I know how to do.