I have been given the following puzzle:

find the smallest number that it's right most digit is 2, and if you remove that digit and place it on the left most side of the number it will double its value

this is what i have gotten:

  • a number we seek (minus last digit)
  • b is the a's digit count+1

$$ 2(10a+2) = 2*10^b+a $$ which yields $$ a = \frac{2*10^b-4}{19}$$

I could not solve the above equation, can any one help me in finding integer solutions (analytically that is - not brute force) ?

b.t.w: the puzzle itself i have solved building the number digit by digit, the solution is very interesting as it is related to the above equation though i cannot understand as to why.


it is the number created by the Repeating decimal of 2/19 (18 digits)

  • 1
    $\begingroup$ Since you already know the answer to this "question", this should probably be on Puzzling.SE instead. $\endgroup$ – A.P. Jun 15 '15 at 15:34
  • $\begingroup$ @A.P. i dont know the answer, as i stated in the question i want to know how to solve the above equation analytically. $\endgroup$ – Mike Jun 15 '15 at 16:13
  • 1
    $\begingroup$ But what is your question, then? And what about the spoiler block? $\endgroup$ – A.P. Jun 15 '15 at 16:36
  • $\begingroup$ You need to make your question more clear or else this post may be closed. $\endgroup$ – Mike Pierce Jun 16 '15 at 0:14
  • $\begingroup$ @MikePierce sorry, you are right. English is not my native tongue. i have edited question to make it more clear. it took me a few re-reads to understand it is not clear. apologies $\endgroup$ – Mike Jun 16 '15 at 6:05

Your equation $a=\dfrac{2\cdot10^b-4}{19}$ is correct, hence you are looking for a $b$ such that $$2\cdot10^b\equiv4\mod19.$$

Then (sorry, this is kind of brute force), compute $2\cdot10^b\bmod19$ for increasing $b$, using the following rules:

  • $2\cdot10^{b+1}\bmod19=10(2\cdot10^b\bmod19)\bmod19$ (compute by recurrence)
  • for even $n=2k$, $10n\bmod19=20k\bmod19=k$ (write the half of $n$)
  • for odd $n=2k+1$, $10n\bmod19=20k+10\bmod19=k+10$ (write $1$ followed by the half of $n$)

Then the successive remainders starting from $b=1$ are


and $b=17$.

The number is $$105263157894736842$$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.