Thanks to RodeoClown, in the comments of that last monkey theorem quote, I now know the magnitude of improbability involved in a monkey creating the works of Shakespeare (or, even just one line from Hamlet).

The balance of probability is so incredibly weighted against a monkey even getting the right sequence of letters in order (every time the monkey strikes a letter there are 31 other keys he might press rather than getting the next stroke right that it is only the constraints of logic that mean we can’t call the situation impossible.

Which kind of makes you think. One of the arguments against God is broken down into two similar questions of probability (which seem a bit like a paradox to me) – those suggesting the idea of the God of the Bible occurring is so improbable that it’s impossible are, at the same time, suggesting that the improbability of the universe must, by definition, have occurred given infinite time and space. To me, both seem equally improbable. In any moment prior to the world (as we know it) existing it was much more likely not to start existing than it was to start existing. That little conundrum seems to be pretty easy to resolve to me – if one is true, then both can be true, but if one is false then both must be false. Wouldn’t an infinite universe over infinite time inevitably produce each possible permutation of God until it produced one able to control the parameters? Namely, the infinite space part? I think at this point it’s more logical that something pre-existed the nothing. That skews the probability pretty dramatically. Am I getting something wrong with my logic here? Now that I’ve read the math guy’s answer right to the end I can see that he agrees with me. He also wrote a follow up piece in which he answers my conundrum from the previous post.

“So what happens if you have an infinite number of monkeys typing away? Do we get a script for Hamlet as Mr Adams suggests? Yes, we do! In point of fact, we get every combination of letters possible with the given typewriter, and that in infinite quantities. So not only do we get Hamlet, we get Shakespeare’s complete works, The Hitchhiker’s Guide to the Galaxy, this document, and incomprehensibly vast quantities of random garbage. (Note that this document may also qualify as garbage, but I object to it being described as “random”.) An infinite number of monkeys typing randomly will rapidly produce every possible written work. “

## The Math

Each time it presses a key, there is a one in 32 chance that it will be correct. To get our little snippet of Hamlet, it will need a total of 41 consecutive “correct” keystrokes. This means that the chances are one in 32 to the power of 41. Let’s look at a table of values.

Keys Chances (one in…)

————————————

1 32

2 32*32 = 1024

3 32*32*32 = 32768

4 32*32*32*32 = 1048576

5 32^5 = 33554432

6 32^6 = 1073741824

7 32^7 = 34359738368

8 32^8 = 1099511627776

9 32^9 = 3.518437208883e+013

10 32^10 = 1.125899906843e+015

…

20 32^20 = 1.267650600228e+030

…

30 32^30 = 1.427247692706e+045

…

41 32^41 = 5.142201741629e+061

…

204 32^204 = 1.123558209289e+307The last figure is included only because it is the largest value that the MS Windows calculator can handle — it’s doing better than my hand-held Casio (old faithful!) which only goes up to 1e+99. Okay, so these figures are pretty vast, but we have a lot of monkeys and they can type fast. So how long will it take, on average, for one of my monkeys to type a line matching that sentence? Hard question. Let’s get an idea of how long we are talking here. How many lines can my monkey type in a year, given that it types at a rate of one line per second?

1 line per second

* 60 seconds per minute = 60 lines per minute

* 60 minutes per hour = 3600 lines per hour

* 24 hours per day = 86400 lines per day

* 365.24 days per year = 31556736 lines per yearIf you have access to Unix, you can calculate this with the dc command, but be warned that it may take quite a while to calculate and annoy other users because the computer is so slow. Use of the nice command is suggested. The syntax, should you care to try, is as follows. Type the dc command, then type the following lines.

99k

1 1 32 41 ^ / – 60 ^ 60 ^ 24 ^ 365 ^

pThe figure that is eventually printed will be the probability (expressed as a value between zero and one) of our monkey not typing our little phrase from Hamlet in the space of one year’s worth of continuous attempts. The answer that it prints looks like this:

0.99999999999999999999999999999999999999999999999999999938

6721844366784484760952487499968756116464000Notice all the nines? Even to fifty or more significant figures, this reads 100%. Okay, so realistically, there is no way that our monkey can do its job in a year. Maybe we should start talking centuries? Millenia? As I understand it, common scientific wisdom suggests that the universe is about 15 billion years old (although they may have revised their dating since I last heard about it). We can easily extend our current figure of one year to count many years. Our calculator will be much faster if we break the calculation down to powers of two and just use the “square” operation, so let’s choose a nice even power of two like 2^34, which is about 17 billion (17,179,869,184 to be precise). The new figure is:

0.99999999999999999999999999999999999999999998946

3961512816564762914005246488858434168051444149065728

## Leave a comment: [3 ]