If $2^n=(... \underbrace{aa...aaa}_{x\text{ times}})_{10}$ for positive integer $n$ then we have

$$2^n=(... \underbrace{aa...aaa}_{x\text{ times}})_{10}=(b\underbrace{aa...aaa}_{x\text{ times}})_{10}=10^x b+a(10^{x-1}+...+1)$$ Where $a$ is a digit between $0$ and $9$ and $b$ is a natural number.

Simplifying more gives $$9 \times2^n=9b \times 10^x + a (10^x-1)$$

Now if $n>3$ and $x>3$ then taking mod 2 gives $v_2(a)>3$ which is impossible. So one $x$ or $n$ is not greater than $3$. But the book says answer is $x=125$. Am I interpret this wrong?

  • 2
    $\begingroup$ Yeah, $x=125$ definitely seems wrong. $\endgroup$ Nov 15, 2018 at 22:47
  • 1
    $\begingroup$ I see that your solution is right. For a different approach, one can prove that $2^{n+500} \equiv 2^n \pmod{10^4}$ for all $n \geq 4$ (by using $\varphi(5^4)=500$, for instance), and up to $n \leq 503$, $x$ only takes the values $\{1, 2, 3\}$, with $2^{39} = 549755813888$ the smallest case with $x=3$. $\endgroup$ Nov 15, 2018 at 22:57

1 Answer 1


If $n\ge 4$, then $2^n$ must be a multiple of $16$, therefore so are its last four digits. There are no factors of $5$ so the last four digits cannot be $0000$. Now, which other possibilities for four identical last digits will give a multiple of $16$? Try them out and see.

The comments identify $2^{39}=...888$. If you work out the part above you are left with what must be the answer.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .