Huffpost Technology
The Blog

Featuring fresh takes and real-time analysis from HuffPost's signature lineup of contributors

John Lundberg Headshot

Monkeys, Shakespeare and the Infinite Library

Posted: Updated:
Print Article

An American named Jesse Anderson has developed a computer program that tests whether enough monkeys typing on enough typewriters could ever reproduce the works of William Shakespeare. Anderson used Amazon's cloud computing system to set up millions of "monkeys" (which are actually simple computer programs) that randomly bang out nine-character combinations. The program cross-references these results against the works of Shakespeare. When a nine-character combination matches anything written by the Bard, that section is removed from the monkeys' "to do" list.

Anderson's monkeys are doing quite well so far. They've been hammering away for just over a month, and have already succeeded in reproducing "The Tempest," "As You Like It," "Love's Labour's Lost" and quite a few other plays and poems to the letter. They should have the rest of Shakespeare's works done in no time.

Anderson freely admits that his project is imperfect: to truly succeed at replicating Shakespeare, a monkey would have to rewrite an entire play -- Anderson is just cobbling together nine-character combinations. He also admits that he was inspired to embark on the project by this clip from The Simpsons and, more substantively, by Émile Borel's infinite monkey theorem. He has a good sense of humor about the whole thing. You can see this for yourself, and follow the progress of his virtual primates, on his terrific blog here.

Of course, Anderson's monkeys aren't exercising any discretion as they pound the keyboard. In reality, they're typing every possible nine-character combination in existence and are only occasionally stumbling upon bits of Shakespeare. The great Argentinean writer Jorge Luis Borges demonstrated the impact of such infinite combinations of letters on human life and thought in his 1941 short story "The Library of Babel." In it, Borges explores the odd realities of a truly infinite library:

Its shelves register all the possible combinations of the twenty-odd orthographical symbols (a number which, though extremely vast, is not infinite): Everything: the minutely detailed history of the future, the archangels' autobiographies, the faithful catalogues of the Library, thousands and thousands of false catalogues, the demonstration of the fallacy of those catalogues, the demonstration of the fallacy of the true catalogue, the Gnostic gospel of Basilides, the commentary on that gospel, the commentary on the commentary on that gospel, the true story of your death, the translation of every book in all languages, the interpolations of every book in all books.

Borges developed the story from an essay he wrote two years earlier entitled "The Total Library," which included a mention of -- you guessed it -- monkeys on typewriters: "(a) half-dozen monkeys provided with typewriters," he wrote "would, in a few eternities, produce all the books in the British Museum."

The lesson to be learned from Borges is that if enough monkeys type at random for a long enough time, they will not just reproduce all the works of Shakespeare, they will reproduce everything ever written about Shakespeare, the screenplay for Shakespeare in Love, and Gwyneth Paltrow's Oscar acceptance speech. The monkeys will also eventually write a screenplay in which monkeys, forced to type randomly on typewriters, rise up and kill their human overseers, along with countless philosophical treatises exploring the reasons why humans would subject them to such a pointless exercise -- something, the UK Telegraph reports, we have already done:

In 2003 the Arts Council for England paid £2,000 for a real-life test of the theorem involving six Sulawesi crested macaques, but the trial was abandoned after a month.

The monkeys produced five pages of text, mainly composed of the letter S, but failed to type anything close to a word of English, broke the computer and used the keyboard as a lavatory.

Suffice it to say that once Mr. Anderson's monkeys finish with Shakespeare, it might be best if we just let this one go.

From Our Partners