# Why hasn't anyone run the monkeys-typing-Shakespeare program through a supercomputer?

**URL:** <https://boards.straightdope.com/t/why-hasnt-anyone-run-the-monkeys-typing-shakespeare-program-through-a-supercomputer/325494>\
**Category:** Factual Questions\
**Created:** [October 10, 2005, 3:07am UTC](https://boards.straightdope.com/t/why-hasnt-anyone-run-the-monkeys-typing-shakespeare-program-through-a-supercomputer/325494 "2005-10-10T03:07:54Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![Lemur866](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/lemur866/32/434_2.png) [@Lemur866](https://boards.straightdope.com/u/Lemur866)\
**Post date:** [October 10, 2005, 3:49pm UTC](https://boards.straightdope.com/t/why-hasnt-anyone-run-the-monkeys-typing-shakespeare-program-through-a-supercomputer/325494/21 "2005-10-10T15:49:12Z")

</div>

> [@Colibri](#):
>
> It has recently been confirmed, however, that it took a single Ring-tailed Lemur only a day-and-a-half to produce the script for _Deuce Bigelow: European Gigolo._

Anti-Lemurist!

---

<div class="post-metadata">

**Author:** ![KlondikeGeoff](https://avatars.discourse-cdn.com/v4/letter/k/3e96dc/32.png) [@KlondikeGeoff](https://boards.straightdope.com/u/KlondikeGeoff)\
**Post date:** [October 10, 2005, 3:51pm UTC](https://boards.straightdope.com/t/why-hasnt-anyone-run-the-monkeys-typing-shakespeare-program-through-a-supercomputer/325494/22 "2005-10-10T15:51:25Z")

</div>

For years I’ve considered the fact that if they could reproduce the works of Shakespeare, then they would likely come up with a lot of excellent new novels.

I always wanted to start the Simian Publishing Company. All that would needed in addition to the monkeys and typewriters would be a bunch of editors to sort the wheat from the chaff, and as soon as the Great American Novel had been produced, it could be rushed to print.

Oh, yeah, of course, truckloads of bananas would be required, but as the monkeys and editors work for next to nothing, it could be quite profitable. 😉

---

<div class="post-metadata">

**Author:** ![Revtim](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/revtim/32/1042_2.png) [@Revtim](https://boards.straightdope.com/u/Revtim)\
**Post date:** [October 10, 2005, 3:52pm UTC](https://boards.straightdope.com/t/why-hasnt-anyone-run-the-monkeys-typing-shakespeare-program-through-a-supercomputer/325494/23 "2005-10-10T15:52:36Z")

</div>

> [@andrewdt85](#):
>
> It got me thinking: why haven’t scientists gotten together like these guys did and run a program like theirs, but w/ a supercomputer, to figure out the age old question (actually, not a question, but a scientific answer to a bewildering claim!): if you put enough monkeys in a room w/ typewriters and let them type long enough, they will eventually produce the entire works of Shakespeare.

It would be a waste of supercomputer resources, because nothing new would be learned. It’s a trivial exercise to find out what the probability of a particular sequence of letters coming up is, once you know how long the sequence is and how often a new random sequence is generated.

Suppose you had enough computing power and/or time to actually run it, and it happens after a thousand years. Then you can say “Oh, it happened after thousand years, which we previously calculated had a 37 percent chance of happening by this time.” Nothing new was learned, and you just wasted a thousand years of supercomputer time that could have been used to generate realistic fake porn of your favorite celebrities.

---

<div class="post-metadata">

**Author:** ![msmith537](https://avatars.discourse-cdn.com/v4/letter/m/d9b06d/32.png) [@msmith537](https://boards.straightdope.com/u/msmith537)\
**Post date:** [October 10, 2005, 4:00pm UTC](https://boards.straightdope.com/t/why-hasnt-anyone-run-the-monkeys-typing-shakespeare-program-through-a-supercomputer/325494/24 "2005-10-10T16:00:46Z")

</div>

> [@Small Clanger](#):
>
> There must be an infinite number of ways of getting (say) Hamlet wrong

Actually there isn’t. Hamlet is a finite number of characters long. There are a finite number of keys on the typewriter. Don’t confuse"infinite" with “incredibly large” number. Also do not assume “infinite” means “every possible combination”.

---

<div class="post-metadata">

**Author:** ![Lemur866](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/lemur866/32/434_2.png) [@Lemur866](https://boards.straightdope.com/u/Lemur866)\
**Post date:** [October 10, 2005, 4:13pm UTC](https://boards.straightdope.com/t/why-hasnt-anyone-run-the-monkeys-typing-shakespeare-program-through-a-supercomputer/325494/25 "2005-10-10T16:13:02Z")

</div>

Look, the calculation is simple. Assume random character distribution, 26 lower case, 26 upper case, 10 numbers, space, carriage return, period, comma, (, ), !, :, ?, and ;.

That makes 72 characters. How many characters long are the entire works of Shakespeare? Let’s call that number S. The odds of getting the works of Shakespeare–or any other specified output–from a random run of a 72 character set is 72^S.

However, for every exact copy of the works of Shakespeare, expect S copies that are off by one character, S^2 that are off by two characters, etc. You’d have to do a lot of proofreading when you get a close copy to ensure that you don’t have a copy that’s off by only a few characters.

Another exploration of this idea was the library of Borges. This library has a copy of every possible book , arranged in order. So the first book in the library is blank, the next book is blank except for one A, the next has AA, the next has AAA, and so on. If you limit books to 500 pages, works longer than that can just take up two volumes.

Of course, if you were dropped into this library and started opening books at random, the likelyhood is that you would never find more than a few coherent sentences even if you searched for a lifetime. Every book you ever read is there, including every book ever written or ever will be…but how can you find them?

---

<div class="post-metadata">

**Author:** ![Small\_Clanger](https://avatars.discourse-cdn.com/v4/letter/s/9fc348/32.png) [@Small\_Clanger](https://boards.straightdope.com/u/Small_Clanger)\
**Post date:** [October 10, 2005, 4:22pm UTC](https://boards.straightdope.com/t/why-hasnt-anyone-run-the-monkeys-typing-shakespeare-program-through-a-supercomputer/325494/26 "2005-10-10T16:22:48Z")

</div>

> [@Lemur866](#):
>
> That makes 72 characters. How many characters long are the entire works of Shakespeare?

But the monkey isn’t restricted to writing a text which matches the length.

And what if he decides to type out **Pi** or **e** first? He’ll never get to start on Hamlet.

---

<div class="post-metadata">

**Author:** ![saoirse](https://avatars.discourse-cdn.com/v4/letter/s/5daacb/32.png) [@saoirse](https://boards.straightdope.com/u/saoirse)\
**Post date:** [October 10, 2005, 4:34pm UTC](https://boards.straightdope.com/t/why-hasnt-anyone-run-the-monkeys-typing-shakespeare-program-through-a-supercomputer/325494/27 "2005-10-10T16:34:09Z")

</div>

Quarto or Folio?  
Because any primate could come up with “this too too sullied flesh”  
Especially one who demonstrates agression by throwing his own feces.

But seriously, a minor nitpick:

> [@Otto](#):
>
> were it done completely randomly without retaining correct letters, it would take 26[sup]13[/sup] trials to hit the correct text, which is more seconds than have elapsed since the solar system was formed.

You can expect it to take 26[sup]13[/sup] seconds. It could happen on the first try.

---

<div class="post-metadata">

**Author:** ![vetbridge](https://avatars.discourse-cdn.com/v4/letter/v/b5e925/32.png) [@vetbridge](https://boards.straightdope.com/u/vetbridge)\
**Post date:** [October 10, 2005, 5:32pm UTC](https://boards.straightdope.com/t/why-hasnt-anyone-run-the-monkeys-typing-shakespeare-program-through-a-supercomputer/325494/28 "2005-10-10T17:32:24Z")

</div>

> [@Priceguy](#):
>
> Given infinite time, you don’t need any more monkeys than one.

_Infinite time_??? Christ, I aint got all day!

---

<div class="post-metadata">

**Author:** ![Chronos](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/chronos/32/134_2.png) [@Chronos](https://boards.straightdope.com/u/Chronos)\
**Post date:** [October 10, 2005, 5:57pm UTC](https://boards.straightdope.com/t/why-hasnt-anyone-run-the-monkeys-typing-shakespeare-program-through-a-supercomputer/325494/29 "2005-10-10T17:57:30Z")

</div>

My favorite musing on the Library of Borges: What do you title the books? If you want each to have a unique title, the titles would have to be as long as the books themselves.

And there are an infinite number of ways to mangle _Hamlet_, but only a finite (though very large) number of ways to mangle it within the same length as the original. The result is that as time approaches infinity, the probability approaches 1 that you will get Hamlet (this is often stated as, given an infinite amount of time, you’re guaranteed to get it). One can debate whether this means that you cannot fail to get _Hamlet_, or if failing simply has zero probability. Personally, I would assert that if you go infinitely and fail to get _Hamlet_, that’s evidence that your selection method was not truly random.

---

<div class="post-metadata">

**Author:** ![Kozmik](https://avatars.discourse-cdn.com/v4/letter/k/8dc957/32.png) [@Kozmik](https://boards.straightdope.com/u/Kozmik)\
**Post date:** [October 10, 2005, 6:47pm UTC](https://boards.straightdope.com/t/why-hasnt-anyone-run-the-monkeys-typing-shakespeare-program-through-a-supercomputer/325494/30 "2005-10-10T18:47:48Z")

</div>

If you have an infinite number of monkeys typing for an infinite number of years then there must be an infinite set of monkeys typing the complete works of Shakespeare AND there must be an infinite set of monkeys typing everything else.

Let’s say that you walk up and check what one of the monkeys has typed so far. Do you find a masterpiece or complete jibberish? How can you explain the laws of probability in cases involving infinity?

Logically, there should be a 50/50 chance but - an infinite number of checkers could check an infinite number of monkeys and only find them typing jibberish! They would never find the infinite set of monkeys typing Shakespeare and would conclude the hypothesis to be a failure.

---

<div class="post-metadata">

**Author:** ![CalMeacham](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/calmeacham/32/35_2.png) [@CalMeacham](https://boards.straightdope.com/u/CalMeacham)\
**Post date:** [October 10, 2005, 6:52pm UTC](https://boards.straightdope.com/t/why-hasnt-anyone-run-the-monkeys-typing-shakespeare-program-through-a-supercomputer/325494/31 "2005-10-10T18:52:12Z")

</div>

My problem is that the damned Monkeys get halfway through “Hamlet”, but then they start typing a Clive Cussler novel or some other gibberish and I have to toss it out!

---

<div class="post-metadata">

**Author:** ![Omphaloskeptic](https://avatars.discourse-cdn.com/v4/letter/o/bcef8e/32.png) [@Omphaloskeptic](https://boards.straightdope.com/u/Omphaloskeptic)\
**Post date:** [October 10, 2005, 7:21pm UTC](https://boards.straightdope.com/t/why-hasnt-anyone-run-the-monkeys-typing-shakespeare-program-through-a-supercomputer/325494/32 "2005-10-10T19:21:03Z")

</div>

> [@Otto](#):
>
> Per the same source, were it done completely randomly without retaining correct letters, it would take 26[sup]13[/sup] trials to hit the correct text, which is more seconds than have elapsed since the solar system was formed.

That’s only true for the Reader’s Digest ultra-condensed version, 13 uppercase alphabetic characters long: “THEY MOSTLY DIE.” (Spacing and punctuation added by editor.) The full text is more like 130000 characters long, giving a somewhat larger (immense understatement here) expected number of trials.

---

<div class="post-metadata">

**Author:** ![CC](https://avatars.discourse-cdn.com/v4/letter/c/f1d935/32.png) [@CC](https://boards.straightdope.com/u/CC)\
**Post date:** [October 10, 2005, 7:23pm UTC](https://boards.straightdope.com/t/why-hasnt-anyone-run-the-monkeys-typing-shakespeare-program-through-a-supercomputer/325494/33 "2005-10-10T19:23:33Z")

</div>

People my age may remember what were quaintly referred to as “comedy records,” which recorded for posterity the comedy routines of many performers. On one of these, Bob Newhart portrayed a technician in one of those labs of monkeys at typewriters. He said, as I remember, " Uh, I think we might have something over here on number 456. It…it says…‘To be or not to be. That is the gazornenbladt’." It tickled me then. Tickles me now.

---

<div class="post-metadata">

**Author:** ![saoirse](https://avatars.discourse-cdn.com/v4/letter/s/5daacb/32.png) [@saoirse](https://boards.straightdope.com/u/saoirse)\
**Post date:** [October 10, 2005, 7:47pm UTC](https://boards.straightdope.com/t/why-hasnt-anyone-run-the-monkeys-typing-shakespeare-program-through-a-supercomputer/325494/34 "2005-10-10T19:47:56Z")

</div>

> [@Chronos](#):
>
> Personally, I would assert that if you go infinitely and fail to get _Hamlet_, that’s evidence that your selection method was not truly random.

That only gives rise to the question: can you start over with a corrected method?

---

<div class="post-metadata">

**Author:** ![CalMeacham](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/calmeacham/32/35_2.png) [@CalMeacham](https://boards.straightdope.com/u/CalMeacham)\
**Post date:** [October 10, 2005, 8:04pm UTC](https://boards.straightdope.com/t/why-hasnt-anyone-run-the-monkeys-typing-shakespeare-program-through-a-supercomputer/325494/35 "2005-10-10T20:04:20Z")

</div>

> [@](#):
>
> voice from the past
> 
> * * *
> 
> People my age may remember what were quaintly referred to as “comedy records,” which recorded for posterity the comedy routines of many performers. On one of these, Bob Newhart portrayed a technician in one of those labs of monkeys at typewriters. He said, as I remember, " Uh, I think we might have something over here on number 456. It…it says…‘To be or not to be. That is the gazornenbladt’." It tickled me then. Tickles me no

Read the end of post #5

---

<div class="post-metadata">

**Author:** ![CC](https://avatars.discourse-cdn.com/v4/letter/c/f1d935/32.png) [@CC](https://boards.straightdope.com/u/CC)\
**Post date:** [October 10, 2005, 8:12pm UTC](https://boards.straightdope.com/t/why-hasnt-anyone-run-the-monkeys-typing-shakespeare-program-through-a-supercomputer/325494/36 "2005-10-10T20:12:59Z")

</div>

:smack: never was real good at speed reading.

---

<div class="post-metadata">

**Author:** ![CalMeacham](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/calmeacham/32/35_2.png) [@CalMeacham](https://boards.straightdope.com/u/CalMeacham)\
**Post date:** [October 10, 2005, 8:16pm UTC](https://boards.straightdope.com/t/why-hasnt-anyone-run-the-monkeys-typing-shakespeare-program-through-a-supercomputer/325494/37 "2005-10-10T20:16:05Z")

</div>

Hey, no need to slaop your forehead. It was just an allusion. I wanted to see if anyone caught it. You named the comedian.

---

<div class="post-metadata">

**Author:** ![andrewdt85](https://avatars.discourse-cdn.com/v4/letter/a/71e660/32.png) [@andrewdt85](https://boards.straightdope.com/u/andrewdt85)\
**Post date:** [October 10, 2005, 9:41pm UTC](https://boards.straightdope.com/t/why-hasnt-anyone-run-the-monkeys-typing-shakespeare-program-through-a-supercomputer/325494/38 "2005-10-10T21:41:25Z")

</div>

I think we should restrict this conversation to what a _finite_ amount of monkeys could do w/ _infinite_ time- b/c if both variables are infinite, I think most of us are in agreement that, as the website linked to above says,

[http://brunching.com/randommonkeys.html](http://brunching.com/randommonkeys.html)  
_Obviously enough, an infinite number of monkeys will instantly come up with Hamlet, along with every other piece of literature from the past, present, and future._

But if the number of monkeys is just ginormous, and the time is infinite, would they produce everything at some point? I am fascinated by the idea small clanger came up with- what if the monkeys simply started typing numbers for all infinity? Or ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ? (I guess if he fell asleep at the typewriter ;)). Or as someone else said, just typing gibberish into eternity?

But w/ that size a number of monkeys, not all of them will type numbers or other marks non-Hamlet for eternity, or a single letter for eternity, and the odds of just getting gibberish- well, is Hamlet (or anything readable) a certainty over eternity?

---

<div class="post-metadata">

**Author:** ![Colibri](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/colibri/32/1841_2.png) [@Colibri](https://boards.straightdope.com/u/Colibri)\
**Post date:** [October 10, 2005, 9:54pm UTC](https://boards.straightdope.com/t/why-hasnt-anyone-run-the-monkeys-typing-shakespeare-program-through-a-supercomputer/325494/39 "2005-10-10T21:54:00Z")

</div>

Yes, if time is _infinite_ even one monkey will eventually produce Hamlet and every other work ever written. And as you mention, if the number of monkeys is infinite one of them will inevitably produce Hamlet in the amount of time it takes to type the number of characters in that work. (More precisely, as **Chronos** says, as either time or the number of monkeys approaches infinity, the probability of Hamlet being produced approaches 1.)

> [@](#):
>
> I am fascinated by the idea small clanger came up with- what if the monkeys simply started typing numbers for all infinity? Or ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ? (I guess if he fell asleep at the typewriter ). Or as someone else said, just typing gibberish into eternity?

If this is the case, then they are not typing randomly, which is one of the assumptions.

---

<div class="post-metadata">

**Author:** ![andrewdt85](https://avatars.discourse-cdn.com/v4/letter/a/71e660/32.png) [@andrewdt85](https://boards.straightdope.com/u/andrewdt85)\
**Post date:** [October 10, 2005, 9:56pm UTC](https://boards.straightdope.com/t/why-hasnt-anyone-run-the-monkeys-typing-shakespeare-program-through-a-supercomputer/325494/40 "2005-10-10T21:56:20Z")

</div>

> [@CC](#):
>
> People my age may remember what were quaintly referred to as “comedy records,” which recorded for posterity the comedy routines of many performers. On one of these, Bob Newhart portrayed a technician in one of those labs of monkeys at typewriters. He said, as I remember, " Uh, I think we might have something over here on number 456. It…it says…‘To be or not to be. That is the gazornenbladt’." It tickled me then. Tickles me now

Just for fun, here’s what my Monkey Shakespeare program window ([http://user.tninet.se/~ecf599g/aardasnails/java/Monkey/webpages/index.html](http://user.tninet.se/~ecf599g/aardasnails/java/Monkey/webpages/index.html)) has produced so far!:

The best five at this point are 30 letters from Coriolanus, and 30 more from Coriolanus, 30 from Pericles, 30 from the Second Part of King Henry IV, and 30 from Julius Caesar. The first one, for instance, happened 2.76004e+55 years into the session, when there were 1.23986e+53 monkeys that had typed 4.35501e+59 pages of gibberish. Here’s that example:

1. Citizen. Before we proceed W zKrSjrjJXF(x)vdBrdFyhvuvC8zKf

which matches

1. Citizen. Before we proceed any further, heare me speake

from Coriolanus. Can you believe a monkey typed that? 😃

And in terms of ‘to be or not to be,’ once a monkey even typed the beginning of King Henry VIII:

Prologue. I come no more

which matches

Prologue.

I come no more to make you laugh; things now  
That bear a weighty and a serious brow,

[Previous page](https://boards.straightdope.com/t/why-hasnt-anyone-run-the-monkeys-typing-shakespeare-program-through-a-supercomputer/325494.md?page=1)

[Next page](https://boards.straightdope.com/t/why-hasnt-anyone-run-the-monkeys-typing-shakespeare-program-through-a-supercomputer/325494.md?page=3)
