# First digits of 2 exponents [closed]

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.

## closed as unclear what you're asking by Shailesh, JMoravitz, Matthew Conroy, Rohan, Claude LeiboviciJan 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.

• what? ${}{}{}{}{}$ – Jorge Fernández Hidalgo Jan 25 '17 at 3:50
• 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$? – Jorge Fernández Hidalgo Jan 25 '17 at 3:51
• no, I meant the first digits. sorry for ambiguity :) – 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.