Saturday, January 03, 2009

More googol fun

Earlier today I posted on twitter that you would need only 333 bits to store the value 10^100 (one googol), which is really just saying that there are about a googol states that 333 bits can be in (actually there are quite a few more ways, but to a rough order of magnitude it's accurate).

That, of course, got me wondering how many bits it would take to represent a googolplex, or 10^googol = 10^10^100. Actually, in my enthusiasm I asked my computer to display a googolplex, since it had so readily displayed a googol (which, written out, is really just 101 characters). But I realized my folly and quickly aborted that request.

But I was still wondering how many bits it would take. It turns out there's actually a straightforward way to solve this problem:

Let's start with the derivation for the number of bits needed to store the value googol.

x = 10^100 = 2^a , where a will represent the needed number of bits

log_10(x) = log_10(10^100) = 100 = log_10(2^a)

How to get the 'a' out? By remembering that log_w(s^t) = t * log_w(s); that log_w(w) = 1, and that we can convert bases as follows:

log_g(p) = log_h(p)/log_h(g)

Therefore,

100 = a * log_10(2)

100/log_10(2) = a * log_10(2)/log_10(2) = a * 1 = a

and so 'a' is ~332.1928 which we'll round UP (since we have to work in whole bits) to 333.

FINE AND DANDY SAYS I :-)

But what about our friend the googolplex?

We can use the same derivation as above, but substitute 100 for 10^100, so that we find

10^100 / log_10(2) = a

or, about 3.32 * 10^100 bits. That's right, we'd need 3 googol bits to store a googolplex. And there aren't that many bits. In the whole universe.

Now, of course, if we used something with more states, then we could represent a googolplex in fewer of whatever we're using; for example, with a three-state object would only need 2 googol of them; with a 60-state object, only 5.6 * 10^99, or about half a googol. Unfortunately, things don't improve very quickly due to that log_10. With a million-state object (10^6), we're only at 1/6 googol, which is still WAY WAY too many.

Anyway, there's not really a point to this rambling, I just think that really large numbers are cool.

No comments:

The City Born Great - How Long 'Til Black Future Month?

The second story in N. K. Jemisin's anthology How Long 'Til Black Future Month? , "The City Born Great," is an exciting ta...