# Is it possible to determine how many digits are required to represent an equation?

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?

• We can write the number as $2^{-368}$ the logarithm to base $10$ is $-110.779$. Feb 26, 2023 at 19:26
• @Peter doesn't that require that we compute the entire equation in the first place? Feb 26, 2023 at 19:32
• @MatthewLayton no logarithms allow us to avoid those complications by using some of their nice properties. For example $\log x^y = y \log x$ is really useful here. Feb 26, 2023 at 19:35
• That's not an equation, as there is no '=' sign. Feb 27, 2023 at 4:06
• @mr_e_man I said maths wasn't my strong point ;) Feb 28, 2023 at 19:17

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.)
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$$).
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$$.