Infinite monkey business?
The Infinite Monkey Theorem claims that a million monkeys randomly typing on a million typewriters will reproduce Shakespeare. Is that really possible?
It was the best of times. It was the blurst of times
Perhaps you've heard it said that a million monkeys randomly typing on a million typewriters would eventually reproduce the text of Hamlet...or the entire works of Shakespeare...or all the books in the British Library. This idea is called the Infinite Monkey Theorem. It states that if letters are randomly generated, either by a theoretical monkey or some other random process, a string of letters will eventually be produced that matches any desired target (a paragraph, a page, a book, etc.).
This thought experiment has been studied by numerous mathematicians, statisticians, and computer scientists. It has also been featured in various works of fiction and has become part of our popular culture, even making an appearance in The Simpsons (Season 4, Episode 17).
In that episode, Mr. Burns leads Homer into a room of his mansion and exclaims, “This is a thousand monkeys working at a thousand typewriters. Soon, they'll have written the greatest novel known to man." Taking a sheet of paper from one of the monkeys' typewriters, he reads, "It was the best of times. It was the blurst of times." With disgust, he yells, "You stupid monkey!"
The scene ends there, but we know from formal mathematical proofs (which mercifully will not be covered here) that if Mr. Burns had just waited long enough, the monkeys would have produced an accurate copy of A Tale of Two Cities. It might have taken a very, very, very long time — probably longer than the life of the universe — but eventually the correct text would have appeared.
The modern formulation of this idea is attributed to Émile Borel, a French mathematician, who apparently took time from grooming his lush beard and mustache to publish an article about probability in 1913 that posited monkeys sitting at typewriters and typing for eternity.
The idea that something complex (like the text of a book) could be assembled entirely at random has never sat well with some people. In 45 BCE, Cicero mocked those who believed such nonsense:
[They] may as well believe that if a great quantity of the one-and-twenty letters, composed either of gold or any other matter, were thrown upon the ground, they would fall into such order as legibly to form the Annals of Ennius. I doubt whether fortune could make a single verse of them. How therefore can these people assert that the world was made by the fortuitous concourse of atoms.1
In the present day, creationists criticize evolution on similar grounds, comparing the genetic sequences encoded in strings of DNA "letters" to the letters in the text of a book.
The Infinite Monkey Theorem is a popular device used by many scientists to defend the idea that DNA code could arise by chance, given infinite time – similar to a bunch of monkeys pounding away on typewriters and eventually delivering a given text, such as Shakespeare's Hamlet.2
These creationists argue that the odds of assembling even a short string of meaningful text (like a sonnet of less than 500 characters) in a reasonable amount of time are infinitesimally small. This realization drove English philosopher Anthony Flew to write in his book There Is A God: How The World's Most Notorious Atheist Changed His Mind (2007):
If the [Infinite Monkey Theorem] won't work for a single sonnet, then of course it's simply absurd to suggest that the more elaborate feat of the origin of life could have been achieved by chance.3
This certainly seems to throw a monkey wrench (forgive me!) into our scientific understanding of the role of random genetic mutations in evolution.
Or does it?
I chimp, therefore I am
The key to understanding the theorem is to specify the time frame of interest. The Infinite Monkey Theorem considers infinity, and given an infinite number of chances, even the most unlikely event will eventually occur. But what has been called the Finite Monkey Theorem considers the chances that monkeys will produce meaningful text over some fixed period of time. There have been three approaches to this, using mathematical calculations, computer simulations, and even a real-life experiment.
A comprehensive 2024 study4 calculated the probability of producing meaningful text under various scenarios:
One chimp typing for its entire lifespan (30 years).
The entire world population of chimpanzees (about 200,000 individuals) typing for their entire lifespan.
The entire world population of chimpanzees typing for the entire lifespan of the universe, keeping the number of chimps constant for the entire period. Scientists estimate the universe will last 10100 years (that's 1 followed by 100 zeroes — a "googol" for those who care about such things).
Each chimp was assumed to type continuously, randomly pressing one key per second on a keyboard containing 30 keys: 26 letters (ignoring case) plus 4 punctuation characters.
The authors calculated the probability of producing target texts of different length, as shown below.
For example, there's about a 5% chance that a single chimpanzee typing continuously for its entire lifetime will produce the word "bananas". However, the chance of that chimp typing "I chimp, therefore I am" is 0.0000000000000000000000001 (10-25). For simplicity, this and other very small numbers are labelled "almost zero" in the table. These probabilities are so small, only infinitesimally larger than zero, that you can safely say they just won't happen.
You can see that a single chimp has only a small chance of typing "bananas" and will never type any of the longer texts. Collectively, the entire population of 200,000 chimps will almost certainly type single words like "bananas", but won't type anything as long as "I chimp, therefore I am". Even over the life of the universe, 200,000 chimps typing continuously won't type any of the longer texts.
The study's authors conclude:
[We] clearly demonstrate that the conclusions from the Finite Monkeys Theorem are at odds with those of the more famous Infinite Monkeys Theorem, which are not applicable in our finite universe.
In other words, randomly typing monkeys won't reproduce Shakespeare within the life of our universe.
(As a side note, I have been advised by an anthropologist friend that chimpanzees are members of the Ape family, not the Monkey family. However, I believe the results above, which are based on imaginary chimps, apply equally to imaginary monkeys.)
2,737,850 million billion billion billion monkey-years
Computer simulations have supported these conclusions. Consider the Monkey Shakespeare Simulator Project, which began in 2003 and operated for about three years.5

This web-based computer program started with 100 virtual monkeys typists, doubling the population every few days. When a user visited the website, the monkeys produced random text which was checked against the archived works of Shakespeare. An astounding 1035 pages of text was produced over the course of the project. By comparison, the Library of Congress contains about 25 million books. If the average length of those books is 350 pages, the generated text would fill the Library of Congress more than 10,000,000,000,000,000,000,000,000 times.
By the end of the project in December 2006, the longest match to Shakespeare within this enormous volume of random text was 24 letters from Henry IV, Part 2 after 2,737,850 million billion billion billion monkey-years.
The monkey-generated text was
RUMOUR. Open your ears; 9r"5j5&?OWTY Z0d "B-nEoF.vjSqj[..."which matched Shakespeare's
RUMOUR. Open your ears; for which of you will stop the vent of hearing when loud Rumour speaks?...Sadly, not a very impressive performance on the part of the monkeys. Alas, so many monkey-years wasted.
To dea now nat to be will and them be does
Some computer scientists have tinkered with their simulators to give the monkeys a better edge. For example, in the calculations and simulations reported above, every letter in the alphabet had an equal probability of being typed, so an "A" was as likely as an "X". Yale physicist William R. Bennett Jr., tried varying letter probabilities to match those used by Shakespeare, so more A's and fewer X's were produced.6
These first-order probabilities weren't much help. He then tried second-order probabilities which were based on all two-letter probabilities, so that, for example, the sequence "AR" was produced more frequently than "AZ". This helped a bit, producing more English-like strings like this:
MY ACT MOUND HARCISTHERK BOMATY HE VESA FLD DELIY LI ER PU HE YS ARATUFO..When Bennett moved on to third-order probabilities (based on groups of three letters), he was able to produce:
TO DEA NOW NAT TO BE WILL AND THEM BE DOES DOESORNS CAI AWROUTROULD.A little more Shakespearean, but still not very poetic.
46 days to success
Undaunted by these failures, computer scientist Jesse Anderson reported in 2011 that he had created a computer simulation that reproduced the entire works of Shakespeare in 46 days.7 Anderson's approach was influenced by the debate between scientists and creationists over the implications of the Infinite Monkey Theorem. As noted above, some creationists claim that the inability of randomly-typing monkeys to reproduce Shakespeare in a reasonable amount of time proves that random combinations of DNA could not produce a working genome.
In the 1980s, evolutionary biologist Richard Dawkins noted that the monkey theorem could be used to demonstrate "the ability of natural selection to produce biological complexity out of random mutations".8 Anderson tested this idea by designing his monkey simulation to work somewhat like evolution.
Anderson's computer program generated nine random letters at a time. Each string of nine letters was checked against Shakespeare's corpus. If one or more matches were found, they were marked in Shakespeare's text as being matched and were removed from future consideration, shortening the inventory of Shakespeare text remaining to be matched. The program then generated another set of nine random letters and removed any matching text from the inventory. This cycle was continued until all of Shakespeare's text had been matched. As Anderson explained:
[My] monkeys did not type out letter after letter independently and indefinitely. Instead, after every nine letters their output was compared to Shakespeare, and was then either rejected as gibberish or selected as being Shakespearian. Selecting and holding on to successful guesses makes all the difference, to evolution and creationism, to Shakespeare, and to me. This is the distinction that creationists fail to acknowledge, and that Dawkins emphasizes; selecting as you go along changes the statistics, the probabilities – and the timescale.
As Anderson pointed out, his program could have matched all of Shakespeare's text in about 20 seconds if he had made one simple change. Suppose instead of selecting nine characters at a time, the program had generated one character at a time. In the first cycle, it might have generated the letter "G". All G's could be removed from Shakespeare's text. Then the next generated letter, "P" let's say, could be removed from Shakespeare, and so forth. The longer the generated string, the lower the likelihood of matching it and the longer it would take to match all of Shakespeare's text. Anderson chose nine characters to prolong project completion for 1 or 2 months — long enough to generate some attention but short enough to end in a reasonable amount of time.
Anderson's demonstration clearly shows that a cumulative selection approach makes a huge difference in how much time it takes to reproduce something of high complexity, be it a written text or a DNA string. A brute-force, fully random approach will get you nowhere in this universe.
Elmo, Gum, Heather, Holly, Mistletoe, and Rowan
This math and computer stuff is all well and good, but the fun really began when researchers at Plymouth University in England discovered that if you give six real-world monkeys a computer for a month, chaos will ensue. The following report explains what happened:
"They pressed a lot of S's," researcher Mike Phillips said Friday. "Obviously, English isn't their first language."
A group of faculty and students in the university's media program left a computer in the monkey enclosure at Paignton Zoo in southwest England, home to six Sulawesi crested macaques. Then, they waited.
At first, said Phillips, "the lead male got a stone and started bashing the hell out of it."
"Another thing they were interested in was in defecating and urinating all over the keyboard," added Phillips, who runs the university's Institute of Digital Arts and Technologies.
Eventually, monkeys Elmo, Gum, Heather, Holly, Mistletoe and Rowan produced five pages of text, composed primarily of the letter S. Later, the letters A, J, L and M crept in.9
No Shakespeare. Not even any words.
Leagues of senseless cacophonies, verbal jumbles, and incoherences
The influence of the Infinite Monkey Theorem extends beyond science and math and into fiction. Let's look at one example, the 1941 short story The Library of Babel by Argentine writer Jorge Luis Borges (which you can read here). Note that all quotations below come directly from that work.
This story describes a vast library "composed of an indefinite and perhaps infinite number of hexagonal galleries". Within each gallery, "there are five shelves for each of the hexagon's walls; each shelf contains thirty-five books of uniform format; each book is of four hundred and ten pages; each page, of forty lines, each line, of some eighty letters which are black in color."
The narrator, one of the countless librarians who inhabit the place, describes the "formless and chaotic nature" of the books:
One which my father saw in a hexagon on circuit fifteen ninety-four was made up of the letters MCV, perversely repeated from the first line to the last. Another (very much consulted in this area) is a mere labyrinth of letters, but the next-to-last page says Oh time thy pyramids. This much is already known: for every sensible line of straightforward statement, there are leagues of senseless cacophonies, verbal jumbles and incoherences.
Sometime in the past, a "librarian of genius" discovered the "fundamental law of the Library": that it contains all possible books.
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.
The story of The Library of Babel turns the Infinite Monkey Theorem on its head. It's not a story about reproducing a particular written work with random typing; instead it tells of a vast repository in which every possible letter combination has already been printed. Almost all of the volumes in the library contain gibberish. But within that morass of nonsense exists every book ever written, or that ever will be written, in any language.
When it was proclaimed that the Library contained all books, the first impression was one of extravagant happiness. All men felt themselves to be the masters of an intact and secret treasure. There was no personal or world problem whose eloquent solution did not exist in some hexagon. The universe was justified, the universe suddenly usurped the unlimited dimensions of hope.
But these “unlimited dimensions of hope” were crushed as the Librarians realized that their chances of finding books of value amid the books of gibberish "can be computed as zero".
As was natural, this inordinate hope was followed by an excessive depression. The certitude that some shelf in some hexagon held precious books and that these precious books were inaccessible, seemed almost intolerable.
Meaning gets lost in a sea of gibberish.
Coco goes to grad school
We‘ve learned from the studies of the Infinite Monkey Theorem that, given enough time, an entirely random process could reproduce a literary masterpiece. But in the real world, or even in the Library of Babel, we’re likely to see nothing more meaningful than something like this:
Poet. Good day Sir FhlOiX5a]OM,MlGtUGSxX4IfeHQbktQ...We've also learned that our infinite-monkey thought experiment is unrealistic in another important respect: real-world monkeys have little interest in typing and prefer instead to try destroying the keyboard.
A satirical essay by Reuven Perlman, published in 2023, imagines a field report from a person observing an infinite array of monkey writers.10 On the first day, the observer reports:
What strikes me immediately...is the absence of any and all writing. Before arriving, I'd steeled myself for a deafening cacophony of tapping keys, margin bells, and the mechanical slides of carriage-return levers. But so far the only thing I've seen typed is "Title TK TK TK," written by Monkey No. 3566, who then took a break to lie on the rug and listen to a podcast.
On the second day:
My presence is now widely known, and any prior concerns about my being rejected by the group have been quashed. In fact, having learned that I'm not a literary agent or a publisher and that I have no connections in Hollywood, the monkeys have started to ignore me entirely.
At 7PM on the 22nd day:
A breakthrough! While most monkeys continued to do what I can only describe as "nothing," Monkey No. 7160043 — nicknamed Coco — experienced a ninety-minute burst of creative energy and has successfully and independently written the entirety of Shakespeare's "Hamlet"! The theorem has been confirmed!
But a few minutes later, in a "devastating yet fascinating turn of events" as Coco finishes "rereading the manuscript with furrowed brow":
Coco has lit her copy of "Hamlet" on fire and...announced her retirement from writing. She plans to apply to grad school in the fall.
As I researched this article, I struggled to explain why the Infinite Monkey Theorem has stimulated so much popular interest over the past century or so. I think it boils down to this: the mathematical part of the theorem is interesting, but the monkey part is fun — more fun than a barrel of….well, you know what I was going to say.
https://www.todayifoundout.com/index.php/2020/02/time-someone-actually-tested-infinite-monkey-theorem/
https://www.blogos.org/thinkabout/infinite-monkey-theorem.html
https://www.blogos.org/thinkabout/infinite-monkey-theorem.html
https://doi.org/10.1016/j.fraope.2024.100171
https://gizmodo.com/the-story-of-the-monkey-shakespeare-simulator-project-5809583
https://www.nytimes.com/1979/03/06/archives/computer-says-monkeys-couldnt-write-hamlet-at-least-not-so-far.html
https://academic.oup.com/jrssig/article-abstract/8/4/190/7029904?redirectedFrom=fulltext&login=false
https://en.m.wikipedia.org/wiki/Infinite_monkey_theorem
https://www.wired.com/2003/05/monkeys-dont-write-shakespeare/
The Infinite-Monkey Theorem: Field Notes by Reuven Perlman, New Yorker, January 16, 2023





How many monkeys typing randomly could write this article, and how long would that take? David, I enjoyed reading this, even if monkeys didn’t write it.
David, this is hilarious. Had me howling like a…..🐒😜