0
$\begingroup$

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.

Thanks.

  • 0
    what? ${}{}{}{}{}$2017-01-25
  • 0
    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$?2017-01-25
  • 0
    no, I meant the first digits. sorry for ambiguity :)2017-01-25

1 Answers 1

1

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.

  • 0
    could you please explain this in an example?2017-01-25