The problem is:

Given a number, find out if this number could be the beginning digits of a 2 exponent & if it can output which power it can be.

As an example given 2 there is answer $8$ which $2 ^ 8 = 256$ which begins with $2$ -> the number given.



closed as unclear what you're asking by Shailesh, JMoravitz, Matthew Conroy, Rohan, Claude Leibovici Jan 25 '17 at 6:31

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ what? ${}{}{}{}{}$ $\endgroup$ – Jorge Fernández Hidalgo Jan 25 '17 at 3:50
  • $\begingroup$ Do you mean the following: Given a number $n$ find if there is a value $k$ such that the last digits of $2^k$ form the number $n$? $\endgroup$ – Jorge Fernández Hidalgo Jan 25 '17 at 3:51
  • $\begingroup$ no, I meant the first digits. sorry for ambiguity :) $\endgroup$ – Alireza Jan 25 '17 at 3:54

Such a number always exists,suppose $n$ is the given number, you just need to find an integer $a$ such that the fractional part of $a\log_{10}2$ approximates the fractional part of $\log_{10}(n)$ from above sufficiently well.

  • $\begingroup$ could you please explain this in an example? $\endgroup$ – Alireza Jan 25 '17 at 4:05

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