3

Maths isn't my strong point, so bear with me...

Consider the following equation:

65536 ^ -23

Scientific Notation

1.66326556250318387496486473290910501884632684934011000036134769212750344872873130323634253270599878982347298639560762710202913347498385519593436371856666117959759724526678511903221928471314026125128684482119644679463422998200172742144786752760410308837890625 × 10^-111

Literal

0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000166326556250318387496486473290910501884632684934011000036134769212750344872873130323634253270599878982347298639560762710202913347498385519593436371856666117959759724526678511903221928471314026125128684482119644679463422998200172742144786752760410308837890625

So × 10^-111 in this case means that the literal value has 111 zeros (1 to the left of the decimal point, and 110 to the right). In total it takes 369 digits to represent the whole value.

Is there any computable relationship between the original equation (65536 ^ -23) and the digit length of the literal result (369), or to put it another way, is there an algorithm that could be used to determine how many digits are required to represent the equation?

NoChance
  • 6,695

2 Answers2

9

If $x$ has a terminating decimal expansion, we can find it by choosing $n$ so that $10^nx \in \mathbb{Z}$, so that $x = \frac{m}{10^n}$ where $m \in \mathbb{Z}$ and $n$ is as small as possible. Then the decimal expansion of $x$ is just the same as the decimal expansion of $m$, but with the decimal point moved to the left $n$ times. In your case, $65536^{-23} = (2^{16})^{-23} = 2^{-368}$. Since $10 = 2 * 5$, we'll need exactly $368$ factors of $10$ to cancel the $368$ factors of $2$. So we get $m = 10^{368}2^{-368} = 5^{368}$ and thus the decimal expansion is given by $2^{-368} = \frac{5^{368}}{10^{368}}$. From there you see that we require 369 decimal digits (including the initial $0$ before the decimal point.)

tobi_s
  • 353
Jair Taylor
  • 17,307
3

Since a positive integer with $n$ digits is between $10^{n-1}$ and $10^n$, $$ n < \log_{10} (n) \le n +1 $$ (with equality on the right only for $10^n$).

To find the number of digits for rational number whose decimal expansion terminates, write the number in scientific notation and use that to count the zeroes you will need.

If you are dealing with powers of $2$ it is generally useful for approximations to know that $$ 10^3 = 1000 \approx 1024 = 2^{10}. $$ That says $\log_{10}(2) \approx 0.3$. In fact it's $0.3010299996\ldots \approx 0.30103$.

Ethan Bolker
  • 103,433