It is sometimes handy to be able to estimate the natural logarithm (ln) of a number. This is actually not too hard, if you adapt a trick from Knuth: the base-2 logarithm is almost exactly the sum of the natural and common logarithms.
   log_2(x) ~= log_10(x) + ln(x)

It's easy to check this formula, and see that it gives ~1% accuracy.

So let's say you're thinking about the density of prime numbers of size ~10600. This is essentially asking what's ln(1e600), so let's use our estimate. log_10(1e600) = 600, obviously. And we also know that 2^10 = 1024 ~= 10^3, so log_2(1e600) ~= 2000. So ln(1e600) ~= 1400 (the correct answer is ~1381.55, so even after fudging the base-2 logarithm, we didn't do too badly!

Log in or registerto write something here or to contact authors.