Testing out the Infinite Monkey Theorem using Amazon Web Services

This site may earn affiliate commissions from the links on this page. Terms of use.

In one of the best Simpsons lines ever, Mr. Burns tells Homer that he has 1000 monkeys chained to 1000 typewriters in an effort to create the greatest novel known to man. The result of the first monkey’s typing goes “It was the best of times, it was the blurst of times” which is just a word different then Charles Dickens’ opening line to A Tale of Two Cities. It’s a moment than any fan of the series knows well.

The Infinite monkey theorem (it’s real… it’s on Wikipedia!) postulates that, with enough time, one of those monkeys would be able to reproduce any of the great works of literature, so long as they were typing at random. The probability of that happening is extremely small, but a lot of weird stuff can happen when things are taking place on an infinite time scale.

Programmer Jesse Anderson wanted to give Amazon’s Web Services — cloud-based storage, data processing, virtual private servers, etc. — a try so he decided to test out the Infinite Monkey Theorem. The monkeys have been replaced with software that outputs random letters and their writing is being combined to recreate the complete works of Shakespeare. That’s 3,696,348 characters in total.

Using Anderson’s method each individual has to type just nine characters that match the source text before the program adds that string to the collected pool of Shakespeare text. This should make the project go much more quickly than if a single monkey had to accidentally recreate a work that is tens of thousands of characters long, which is how the theory generally goes.

It’ll be much cheaper as well. Amazon’s web services aren’t free, the company charges for things like CPU usage time, storage, and bandwidth. They do make it possible for someone with Anderson’s skills to get serious processing power and access certain frameworks without have to every build a server though. Plus, the services tend to go for a few cents per unit (CPU hours, gigabytes of data transferred, etc.) so he won’t have to spend a ton on a project like this one.

How are the virtual monkeys doing so far? They’re getting there. Below you can see the blocks of text they’ve matched to Shakespeare’s works in green. The white is strings of text that the monkeys have yet to replicate.

Speak Your Mind

naj

send this to Karl Pilkington immediately!

Seljo Myeri

This isn’t exactly proving the theorem. One has to assume the end result is known. Typically, this argument is used in the realm of evolution. So, we have an EXTRA piece: the software that matched the random output to a known control, in this case works of Shakespeare. The theorem doesn’t say anything about this “intelligent combiner” that is taking the pieces and assembling them into a predetermined meaningful arrangement. One would have to take the virtual monkeys’ outputs and RANDOMLY combine those to PROVE the theorem.

FreeYourMind

I think it was 10,000 monkeys on 10,000 typewriters not 1000.

a_brit

I’m pretty sure that we can’t actually create an infinite of monkeys to work for an infinite amount of time. So how do we prove this theory, we don’t. Just assume it’s true as if something happens randomly for an infinite amount of time then everything possible will happen.