Can a large number of monkeys write Hamlet?

  • Thread starter phoenixthoth
  • Start date
In summary, the conversation discusses the possibility of monkeys randomly typing out the entire play of Hamlet, character for character. The probability of this happening is highly unlikely, with the estimated number of monkeys needed being (google)^3465. However, this calculation does not take into account the addition of a "STOP" key, which would significantly decrease the chances of producing Hamlet. While the probability is not zero, it is still extremely unlikely.
  • #1
phoenixthoth
1,605
2
I think if they were given enough time, and large means what it sounds like, then the expected value of number of monkeys that reproduce Hamlet, character for character, would be any number you like (so greater than 1 if there were enough monkeys).

Let's say you give them a special keyboard that has only letters, space, and a shift key. Then there are 53 different keystrokes. Only one in 53 is the correct first character in Hamlet.

So 1/53 of the monkeys will get the first character right.

Of those, 1/53 will get the second character right.

There are about 200,000 characters in Hamlet. So the probability a monkey will type out Hamlet is less than (1/53)^200000 which is around 1 times ten to the -344855 power. In other words, there are about 344850 ZEROS before the decimal point. So it's pretty unlikely.

I think a google is 10^100. If you have one google raised to the 3449 power, or so, monkeys, all typing, then the expected value is that ONE of those (google)^3449 monkeys will produce Hamlet. Anything less than (google)^3449 monkeys will PROBABLY not produce Hamlet.

This is to skirt the issue of how many of those monkeys will STOP at HAMLET and not keep going. If a monkey keeps going, that should DISQUALIFY it from being considered a real Hamlet.

So let's revise it and give each monkey the option to stop. So let's model that by having 54 keys instead of 53, where the new 54th key is STOP WRITING.

OK, now the probability that a monkey will type all the right characters in Hamlet and Stop at the right time, without adding extra stuff, is (1/54)^200000 or so which is about 10^(-346479), meaning that now you need (google)^16 times as many monkeys as before to get the expected value of 1 Halmet.

Bottom line: you'll average one copy of Hamlet per every (google)^3465 monkeys you have.

Given the comparison between a million, or even a trillion, to the sort of numbers involved here like needing (google)^3465 to get ONE Hamlet (on average), there is basically no way a million or trillion monkeys will do it, if everything is totally random. It's safe to say that (google)^3465 is incomprehensibly bigger than the number of monkeys that ever lived on Earth or ever will and, so, realistically, no real group of monkeys will ever produce Hamlet.

But since i added the 54th key, I have ignored the fact that all the monkeys who press key number 54 stop and if they stop before Hamlet is finished, there is NO change they will ever get Hamlet. So consider these numbers as upper bounds.
 
Physics news on Phys.org
  • #2
Yes, this is an example of the "infinite monkey theorem".
 
  • #3
kewl
 
  • #4
Though it is doubtful that the monkeys would write "Hamlet" if the keyboard has no punctuation marks. :P
 
  • #5
oh yeah
 
  • #6
also.. how do you define "stop" wouldn't you have to wait infinitely long to see whether the monkey ever types again? ;)
 
  • #7
how is stop ambiguous? ;)
 
  • #8
Terminology: Google is the search engine / advertising / general technology company. The number is googol.
 
  • #9
phoenixthoth said:
how is stop ambiguous? ;)

There's a flaw with the "STOP" key addition.

All the other keys can be pressed an indefinite number of times. Your calculations have to factor in that the stop key is NOT pressed UNTIL the other 200,000 characters have been typed.
 
  • #10
phoenixthoth said:
Let's say you give them a special keyboard that has only letters, space, and a shift key. Then there are 53 different keystrokes. Only one in 53 is the correct first character in Hamlet.

So 1/53 of the monkeys will get the first character right.

Of those, 1/53 will get the second character right.

There are about 200,000 characters in Hamlet. So the probability a monkey will type out Hamlet is less than (1/53)^200000 which is around 1 times ten to the -344855 power. In other words, there are about 344850 ZEROS before the decimal point. So it's pretty unlikely.

Under your restrictions (just letters and spaces) I get just under 163,000 characters, which gives about 10^-281057, admittedly pretty large. If capitalizations is ignored it's more like 10^-233312. This is similar to the probability of randomly selecting all the people in a large college out of the world.
 
  • #11
DaveC426913 said:
There's a flaw with the "STOP" key addition.

All the other keys can be pressed an indefinite number of times. Your calculations have to factor in that the stop key is NOT pressed UNTIL the other 200,000 characters have been typed.

As I said: But since i added the 54th key, I have ignored the fact that all the monkeys who press key number 54 stop and if they stop before Hamlet is finished, there is NO change[*] they will ever get Hamlet. So consider these numbers as upper bounds.

So how is STOP ambiguous?[*]Here is another "terminology" error: by change I meant chance. One could call that a typo or spelling error...to each his own.
 
Last edited:
  • #12
CRGreathouse said:
Terminology: Google is the search engine / advertising / general technology company. The number is googol.

Terminology: Terminology has to do with definitions. Google vs googol is spelling.
 
Last edited:
  • #13
CRGreathouse said:
Under your restrictions (just letters and spaces) I get just under 163,000 characters, which gives about 10^-281057, admittedly pretty large. If capitalizations is ignored it's more like 10^-233312. This is similar to the probability of randomly selecting all the people in a large college out of the world.

What college has 10^233312 students?

OK, so I get really around 191000 characters but I think you might be missing the point which is that the probability is not zero. However, the way this statement is sometimes made, with numbers in the millions or trillions, the expected number of monkeys producing Hamlet is far less than one.
 
  • #14
phoenixthoth said:
As I said: But since i added the 54th key, I have ignored the fact that all the monkeys who press key number 54 stop and if they stop before Hamlet is finished, there is NO change[*] they will ever get Hamlet. So consider these numbers as upper bounds.
Yes, I suppose the chances don't change.
 
  • #15
DaveC426913 said:
Yes, I suppose the chances don't change.
Why is that? I think it's obvious that if there is a stop key, the chances change. If there is no stop key, the probability is zero that a monkey will write hamlet while if there is a stop key, there is a chance, albeit small.
 
  • #16
I just checked and found the estimated hydrogen atoms in the universe is only 5x10^68.

Obviously we have absolutely no space to accommodate the monkeys.
 
  • #17
Maybe in one parallel universe, there are a lot of monkeys banging away at keyboards...

So practically speaking, it's basically impossible.
 
  • #18
CRGreathouse said:
Under your restrictions (just letters and spaces) I get just under 163,000 characters, which gives about 10^-281057, admittedly pretty large. If capitalizations is ignored it's more like 10^-233312. This is similar to the probability of randomly selecting all the people in a large college out of the world.

phoenixthoth said:
What college has 10^233312 students?

I was assuming 40,000 to 50,000 students -- a big college, but not unheard-of. There's one 2.5 hours away from me, for example; it seemed reasonable. How do you get 10^233312 students? There are ~6.6 billion people on earth, so

[tex]{6,600,000,000 \choose 50,000}\approx3.9\times10^{277740}[/tex]

phoenixthoth said:
OK, so I get really around 191000 characters but I think you might be missing the point which is that the probability is not zero. However, the way this statement is sometimes made, with numbers in the millions or trillions, the expected number of monkeys producing Hamlet is far less than one.

It's rather insulting to suggest I don't know the probability is nonzero but small. I did the calculations just as you did, and even gave another example of an event with similar probability. Another example of an event with similar probability would be choosing (uniformly at random) the optimal tour for this TSP circuit.
 
  • #19
phoenixthoth said:
So practically speaking, it's basically impossible.

I don't think anyone has called it practical. If you wanted practical, you should "lock in" correct characters, in which case the work (punctuation and all) could be finished in ~20,000,000 keystrokes.
 
  • #20
Point out a hidden assumption

Someone should probably remark that phoenixthoth was trying to compute the probability of outputing the text of Hamlet assuming that each keystroke is made independently of the others. A more useful Markov chain model based on n-grams would product text which would wander but would statistically resemble the letter frequencies, digram frequencies, ... and n-gram frequencies of the text of Hamlet. This was in fact used by Shannon to suggest the meaning (and limitations) of his entropy measure. See http://www.math.uni-hamburg.de/home/gunesch/entropy.html

Note that even obtaining "grammatical text" , much "ageless quality text" by a highly idealized stochastic simulation is implausible. This suggests the limitations of such simulations, not that Shakespeare could not have existed :rolleyes:

I hopefully presume that this discussion has nothing to do with cranky claims about "blind watchmakers".
 
Last edited:
  • #21
Chris Hillman said:
A more useful Markov chain model based on n-grams would product text which would wander but would statistically resemble the letter frequencies, digram frequencies, ... and n-gram frequencies of the text of Hamlet. This was in fact used by Shannon to suggest the meaning (and limitations) of his entropy measure. See http://www.math.uni-hamburg.de/home/gunesch/entropy.html

Note that even obtaining "grammatical text" , much "ageless quality text" by a highly idealized stochastic simulation is implausible. This suggests the limitations of such simulations, not that Shakespeare could not have existed :rolleyes:

Shades of SCIgen!
 
Last edited:
  • #22
CRGreathouse said:
I was assuming 40,000 to 50,000 students -- a big college, but not unheard-of. There's one 2.5 hours away from me, for example; it seemed reasonable. How do you get 10^233312 students? There are ~6.6 billion people on earth, so

[tex]{6,600,000,000 \choose 50,000}\approx3.9\times10^{277740}[/tex]

Oh, ok, you mean something like how many different large colleges would be possible, ie, how many ways 50000 students can be selected from the world's population.
The way you phrased it:
This is similar to the probability of randomly selecting all the people in a large college out of the world.
(emphasis added by me)
It sounds like you're suggesting there is a college with 10^233312 students.



CRGreathouse said:
It's rather insulting to suggest I don't know the probability is nonzero but small. I did the calculations just as you did, and even gave another example of an event with similar probability. Another example of an event with similar probability would be choosing (uniformly at random) the optimal tour for this TSP circuit.
That sounds like something you should work on.
When you said something implying that 10^233312 students is comparable to a large college, I had my doubts as to whether or not you did know.
 

1. Can a large number of monkeys actually write Hamlet?

The answer to this question is highly debated among scientists. Some argue that given an infinite amount of time and an infinite number of monkeys, it is possible for them to eventually produce the complete works of Shakespeare, including Hamlet. However, others argue that the probability of this happening is so incredibly low that it is practically impossible.

2. How many monkeys would be needed to write Hamlet?

This question is difficult to answer definitively, as it depends on various factors such as the intelligence and typing speed of the monkeys, the version of Hamlet being written, and the amount of time given. However, some scientists estimate that at least 10183,800 monkeys would be needed to have a reasonable chance of producing Hamlet.

3. Has anyone ever attempted to test this theory?

Yes, there have been several experiments conducted to test this theory. In 2003, researchers at Plymouth University placed a computer with a keyboard in a cage with six Sulawesi crested macaques for a month. However, the monkeys only produced five pages of text, mainly consisting of the letter "S". In 2011, a project called "The Monkey Shakespeare Simulator" was launched, where a computer program generated random sequences of characters until they matched a line from Hamlet. However, after running for 5 weeks, the program only produced 24 letters from the opening line of the play.

4. Can monkeys actually learn to write?

While some species of monkeys have been shown to possess cognitive abilities and communication skills, there is no evidence to suggest that they are capable of learning to write in the same way that humans do. Monkeys do not have the same physical and cognitive abilities as humans, making it unlikely for them to be able to learn a complex skill like writing.

5. What does this theory tell us about the infinite possibilities of the universe?

This theory, known as the "infinite monkey theorem", raises questions about the vastness and complexity of the universe. It suggests that given enough time and resources, even the most improbable events can occur. Some scientists argue that this highlights the infinite possibilities and potential for life and intelligence in the universe, while others see it as a mathematical curiosity with no real-world implications.

Similar threads

  • Introductory Physics Homework Help
Replies
7
Views
3K
  • Set Theory, Logic, Probability, Statistics
Replies
7
Views
337
Replies
2
Views
637
  • Math Proof Training and Practice
2
Replies
40
Views
14K
  • Set Theory, Logic, Probability, Statistics
Replies
18
Views
2K
  • Biology and Chemistry Homework Help
Replies
1
Views
625
  • Set Theory, Logic, Probability, Statistics
Replies
4
Views
1K
  • Precalculus Mathematics Homework Help
Replies
12
Views
992
  • STEM Career Guidance
Replies
27
Views
1K
Replies
5
Views
2K
Back
Top