## Tuesday, June 25, 2013

### Interview Doubler

Problem:

Find the smallest positive number that doubles when you move the last digit to the front.

Solution:

The answer is $$105263157894736842$$, and the solution is similar to Twisty Temperature. Let this number be $x = x_{n}\cdot 10^{n-1} + ... + x_{1}\cdot 10^1 + x_{0}$ with $$0 < x_{n} < 10$$, then after moving the last digit to the front we get $y = x_{0}\cdot 10^{n-1} + (x-x_{0})/10.$ We also have that $$y = 2 x$$, so our equation becomes $19\cdot x = x_0 \cdot (10^{n}-1).$ Now 10 is a primitive root modulo 19, and so it follows that $$x$$ is integral if and only if $$n$$ is of the form $$18\cdot m$$. Also note that we need $$2 \le x_0 \le 9$$ since we require $$0< x_{n} < 10$$. When $$m=1$$ and $$x_0 = 2$$ we get $$x =105263157894736842$$; when $$m=2$$ and $$x_0 = 2$$ we get $2 (10^{36}-1)/19 = 105263157894736842105263157894736842.$ That this number indeed doubles when you move the last digit to the front can be verified by WolframAlpha.