October 6, 2011

Infinite monkeys, Shakespeare, and all that…

There was a large amount of fuss made about a week ago (26/09/2011) at various news and hi-tech blog sites about story claiming that “this is the first time a work of Shakespeare has actually been randomly reproduced.” On the surface of it, this seemed utterly implausible.

For those of you not familiar with the “Infinite Monkeys theorem”, it essentially states that “an infinite number of monkeys randomly bashing away on typewriters/keyboards for an infinite amount of time will almost surely recreate the entire works of Shakespeare.” You can read more about it here on Wikipedia.

I took a look at the author’s own site and found the description of his experiment quite confusing with poorly defined objectives. It seemed to me that he was just randomly generating character sequences and if he found a matching word within the relevant Shakespeare text, then he counted it as completed. This is not what I understood as the Infinite Monkeys theorem because there is no requirement that the words be generated in the correct order. What was even more puzzling was his choice of 9-characters at a time.

I asked my esteemed colleague Professor Thomas Lumley for his thoughts on the matter. He had this to say:

“In order to get this to work in reasonable time, it sounds as though he is working with nine-character random strings and keeping each string if it matches some nine-character substring of Shakespeare. This means that he is guaranteed to finish in about 27^9 samples (if he uses just letters and spaces).

If he used one-character sequences it would be over a lot faster, and with 20-character sequences it would take a very, very long time.

I assume the 9-character limit was so that the Bloom filter fits in memory easily.”

Thomas also discovered another blogger making almost identical points.

It seems that the Bard is safe from monkeys for some time to come.


James Curran's interests are in statistical problems in forensic science. He consults with forensic agencies in New Zealand, Australia, the United Kingdom, and the United States. He produces and maintains expert systems software for the interpretation of evidence. He has experience as an expert witness in DNA and glass evidence, appearing in courts in the United States and Australia. He has very strong interests in statistical computing, and in automation projects. See all posts by James Curran »