In this article I’m going to go over a technique for evaluating the base-2 logarithm of any number, especially huge ones, but first, let me review what a logarithm is: as Wikipedia says,
To put it simply, when I write log2 512, where 2 is the base, what I mean is: “if 2 to the x equals 512, how much is x?” In this case, the answer is 9.
Base-2 logarithms in particular are extremely useful in computer science, since computers use bits, or binary digits, to store data; so for example if you want to know “How many bits do I need to store every number up to 10,000,000?”, the answer is simply log2 10,000,000.
Now that you know something about what logarithms are and what they are used for, there’s one last thing you need to know to use this method: you have to memorize the first 10 powers of 2, or you can even compute those when you need to, you just have to double the value to get to the next one.