4
$\begingroup$

I am trying to find the answer to: 2^34359738368. As to be expected every calculator and computer program I have used has crashed.

To be honest I don't even want to know the exact answer, I just want to really roughly know the number of digits the answer has.

Is there a trick to doing something like this or is it something that should be put into the too hard basket?

Reason: I want to know how big of a number the binary for a 4gb file is

$\endgroup$
  • 7
    $\begingroup$ The number of digits of $n$ is $$1+\lfloor \log_{10}n \rfloor=\lceil\log_{10}n \rceil$$ $\endgroup$ – lab bhattacharjee Jun 4 '13 at 4:38
6
$\begingroup$

Are you familiar with logarithms? There is a way to get the exact number of digits in this expression using logarithms. Our number system is written in base 10, i.e., each integer $a$ with $k$ digits and decimal representation $d_{k-1}d_{k-2}\ldots d_{0}$ can be expressed as $10^{0}*d_{0} + 10^{1}*d_{1} + \cdots + 10^{k-1}d_{k-1}$. To get the number of digits, therefore, we need to find the highest power of $10$ appearing in this expression and add $1$ to it. We can easily see that this is given by taking the floor of the base 10 logarithm of $a$ and adding 1, or #digits$(a) = \lfloor \log_{10} a \rfloor + 1$.

Using this information, we can now find the number of digits contained in $2^{34359738368}$ by using the properties of logs. We have #digits$(2^{34359738368}) = \lfloor \log_{10} (2^{34359738368}) \rfloor + 1 = \lfloor 34359738368 \log_{10}(2) \rfloor + 1$

$\endgroup$
  • $\begingroup$ Perfect! I have had a little to do with them a while ago so ill give it a go. Thanks $\endgroup$ – Darcys22 Jun 4 '13 at 4:52
  • $\begingroup$ My pleasure! Feel free to comment again if you have any more questions :) $\endgroup$ – Alex Wertheim Jun 4 '13 at 4:53
  • $\begingroup$ haha 10 billion digits, whoa $\endgroup$ – Darcys22 Jun 4 '13 at 5:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.