Calculating logs in your head I quite often need to estimate $\log_2(x)$ for positive integer values of $x$.  I find it frustrating that I have to rely on a calculator/computer to do this.  By way of contrast, I can happily compute as many decimal places as I like of $\frac{x}{y}$ in my head as long as $x$ and $y$ aren't too large using simple schoolbook long division. 

What is a good way to estimate $\log_2(x)$ in your head?

To make the question more concrete, take $\log_2(10)$ or $\log_2(10^{20})$.
 A: You can use the rough approximation of $10^3 \approx 2^{10}$ for 1sf computations.
$\log_2(10) = \frac{1}{3} \log_2(1000) \approx \frac{1}{3} \log_2(1024) = \frac{10}{3}$.
If you want more precision, remember that $\ln(1+x) \approx x - \frac{1}{2} x^2$ as $x \to 0$, so taking just the first-order term we get $\log_2(1.024) = \frac{\ln(1.024)}{\ln(2)} \approx \frac{0.024}{\ln(2)}$. Now you can either use $\ln(2) \approx .693$ for 3sf precision, or you can use a rational approximation $\ln(2) \approx \frac{9}{13}$, which gives $\log_2(1.024) \approx \frac{104}{3000}$, and hence $\log_2(10) \approx \frac{10}{3} - \frac{104}{9000}$, which is good to 4 significant figures!
And from that we get $\log_2(10^{20}) \approx \frac{200}{3} - \frac{208}{900}$.
A: As user21820 says, your best friend is the identity $1024 = 2^{10} \approx 1000 = 10^3$, which gives $\log_2 10 \approx 3.3$ and $\log_2 10^{20} \approx 66$. Using this approximation, you now know how $\log_2 n$ behaves upon either multiplying or dividing $n$ by either $2$ or $5$ (approximately in this case), since you now know $\log_2 5 \approx 2.3$, and so you can estimate $\log_2 n$ by approximately writing $n$ as a product of powers of $2$ or $5$. If you memorize more logarithms of small integers and/or memorize $\log_2 5$ to more precision you can do even better. 
For example, suppose you want to estimate $\log_2 75$. This is $\log_2 3 + \log_2 25 \approx \log_2 3 + 4.6$, so you're reduced to estimating $\log_2 3$. Well,
$$\log_2 3 = \log_2 15 - \log_2 5 \approx \log_2 16 - 2.3 = 1.7$$
and hence $\log_2 75 \approx 1.7 + 4.6 \approx 6.3$ (in fact it is $6.23 \dots$). 
Or suppose you want to estimate $\log_2 21$ (I generated this example randomly). This is approximately $\log_2 20 = 2 + \log_2 5 \approx 4.3$ (in fact it is $4.39 \dots$). 
You can always sanity check these calculations by checking that they have the right integer part: $\lfloor \log_2 n \rfloor$ is the largest $k$ such that $2^k \le n$. 
A: Let $n$ denote the number of digits in the decimal representation of $x$.
Let $d$ denote the most significant digit in the decimal representation of $x$.
Then $\log_2x\approx3(n-1)\cdot(\log_2d+1)$, where:


*

*$d=1\implies\log_2d+1=1$

*$d=2\implies\log_2d+1=2$

*$d=3\implies\log_2d+1\approx2.5$

*$d=4\implies\log_2d+1=3$

*$d=5\implies\log_2d+1\approx3$

*$d=6\implies\log_2d+1\approx3.5$

*$d=7\implies\log_2d+1\approx4$

*$d=8\implies\log_2d+1=4$

*$d=9\implies\log_2d+1\approx4$



So for the example of $x=10^{20}$:


*

*$n=21$

*$d=1$

*$\log_2x\approx3\cdot20\cdot1=60$


If you wish to achieve slightly better accuracy, then use $3.3$ ($\approx\log_210$) instead of $3$.
