A Universe of Monkeys Couldn't Type Hamlet

Really. There's an idea going around that a monkey typing for an infinite time would eventually type the complete works of Shakespeare. In fact the age of the Universe (about 14.7 billion years) is tiny compared to the time it would take for that tireless monkey to peck out Hamlet, never mind all the other great works of the Bard.

A monkey (or machine) picking random letters has one chance in 26 of correctly choosing the first letter of Hamlet, which happens to be an "A" (Actus Primus. Scoena Prima.) There's one chance in 676 (26 X 26) of choosing the first two letters. The probability goes down exponentially, so to get the first 20 letters correct there's already only one chance in 2620 or one in 19,928,148,895,209,409,152,340,197,376. That's about the same as buying four tickets in consecutive lotteries and winning the jackpot each time.

The text of Hamlet, even without punctuation and spaces, contains 133,874 letters which means the probability of a randomly picking them all in the right order is one in 3.4×10183946. That's a very big number. Consider that there are only about 1079 atoms in the observable universe and only 1017 seconds have elapsed since the Big Bang.

Even if the universe were filled with monkeys and they'd been typing since the Big Bang the chance that they would have produced Hamlet would still be less than one chance in 10183800.

But in the 1980s Richard Hardison of Glendale College wrote a computer program that generated phrases randomly while preserving the positions of individual letters that happened to be correctly placed (in effect, selecting for phrases more like Hamlet's). Kinda like how evolution selects for adaptive changes produced by mutations. On average, the program re-created the phrase TOBEORNOTTOBE in just 336 iterations, less than 90 seconds. Even more amazing, it could reconstruct Shakespeare's entire play in just four and a half days. Now that's the power of natural selection.

As Shakepseare wrote: Though this be madness, yet there is method in 't.

6 comments:

Anonymous said...

Your example confirms why the world is full of stupidity. Was there a computer programmer around at the inception of life? Even Charles Darwin for his theory needed God at the beginning to get things jump started.

Anonymous said...

I'm with stupid. Who's handling the catering?

Tom Harnish said...

I guess you must have religious backgrounds. It's the only reason I can think of for why you would take a simple story, an illustration, twist the facts and then argue against it as it it were literally true. Anyhow, who said anything about a programmer at the inception of life, or for that matter at the Big Bang, which was waaaaaay before life evolved.

G said...

I had an idea once to write a program to try to reproduce monlisa random sequences but just and idea. Props to programmer respect. I know that power of myth is way more useful to life then science. Look around there's moden fiction everywhere. I think the debate moot. There's a dynamic world both described by science and myth relish in fact both can exist and does in society!!

Mike said...

And I wonder why there is no link...? Because it is not possible.

Anonymous said...

@G Was your comment generated by computer? Some rather random strings of words there..........