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

Anti-Lemurist!

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. :wink:

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.

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”.

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?

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.

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:

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

Infinite time??? Christ, I aint got all day!

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.

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.

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!

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.

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.

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

Read the end of post #5

:smack: never was real good at speed reading.

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

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
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?

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.)

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

Just for fun, here’s what my Monkey Shakespeare program window (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? :smiley:

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,