Millions of virtual monkeys have almost typed out the entire works of Shakespeare by bashing random keys on simulated typewriters.

The virtual monkeys, created by an American programmer, have already typed up the whole of the poem A Lover’s Complaint and are 99.99 per cent of the way through the Bard’s complete works.

The experiment attempts to prove the theory that an infinite number of monkeys sitting at an infinite number of typewriters would eventually reproduce the works of Shakespeare by chance.

Jesse Anderson, the programmer behind the project, said he was inspired by an episode of The Simpsons which spoofs the famous problem.

Mr Anderson set up millions of small computer programmes, or virtual monkeys, using Amazon’s SC2 cloud computing system, and programmed them to churn out random sequences of nine characters.

If the nine-letter sequence appears anywhere in one of Shakespeare’s writings, it is matched against the relevant passage in a copy of the Bard’s complete works, and is checked off the list.

Hang on, though, that’s cheating, innit?

I always understood the infinite monkeys theory to be that eventually they would produce all of Shakespeare’s works as written.  In other words, there is one complete sequence of typewriter keypunches, out of all the jillions of possibilities, which if entered will give you the whole of Romeo and Juliet or Hamlet or whatever else.   This experiment sounds more like flinging random chunks of monkey poo at a wall until it’s completely covered.

Reminds me of the old Bob Newhart routine: “Yeah, Jerry, I’m gonna go down and check on No. 92.  I think he might have something.  Lessee….’To be, or not to be.  That is the rackafratz.'”

UPDATE:  Whoops, perhaps I should have read below the fold, because the Telegraph is way ahead of me:

But the experiment is an imperfect reproduction of the infinite monkey theorem because it saves correct sections of text while discarding future wrong guesses, experts said.

Dr Ian Steward, emeritus professor of mathematics at Warwick University, said that for the monkeys to type up the complete works in the correct order without mistakes would take much longer than the age of the universe.

He told the BBC: “Along the way there would be untold numbers of attempts with one character wrong; even more with two wrong, and so on.

“Almost all other books, being shorter, would appear (countless times) before Shakespeare did.”

The fellah running the thing seems to be aware of his own weakness.

Writing on his blog, Mr Anderson said: “This is the largest work ever randomly reproduced. It is one small step for a monkey, one giant leap for virtual primates everywhere.

“I understand the definition of infinite and infinite monkey theorem and I realise that this project does not have infinite resources.

“No monkeys were harmed during the making of this code. This project is my attempt to find a creative way to attain an answer without infinite resources.”

Which of course, given that it’s a question of infinity, is an impossibility.  Sounds to me more like an attempt to find a creative way to screw around.  Who’s paying for all this?

And speaking of monkey poo:

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.

I find that last mental image infinitely amusing.