Let us assume, for the sake of calculation, that the monkey uses the pencil to write legible characters chosen completely at random, rather than drawing squiggles or eating the lead.
The Variables:
- The Text: Shakespeare’s Hamlet contains approximately 130,000 characters (including letters, punctuation, and spaces).
- The Character Set: To write English, you need at least 26 letters, a space, and basic punctuation. Let’s be generous and assume a "keyboard" of only 30 possibilities to simplify the math.
The Equation:
The probability of getting the first character right is 1 in 30.
The probability of getting the first two characters right is
The Result:
What this number means: To understand how impossible this number is, consider the observable universe:
- The number of atoms in the observable universe is roughly
$10^{80}$ . - The number of seconds since the Big Bang is roughly
$10^{17}$ .
The probability is not just "low." It is statistically indistinguishable from zero. If every atom in the universe were a monkey writing 1,000 characters per second since the beginning of time, they would not have even come close to producing the first page of Hamlet.
You asked about an "average monkey" with a "pencil." This adds physical and behavioral variables that make the mathematical probability look optimistic.
The "Pencil" Variable: The mathematical model above assumes a typewriter, where pressing a key guarantees a legible letter. With a pencil, the monkey is not selecting from a finite set of 30 characters; it is selecting from an infinite set of geometric shapes. The probability of a monkey moving a pencil to accidentally form a perfect letter "T" is low; the probability of it forming a lowercase "e" is even lower.
The Behavioral Variable: In 2003, researchers at Plymouth University conducted a test closer to your question. They placed a computer keyboard in a cage with six Celebes crested macaques for a month.
- The Result: The monkeys did not type random characters uniformly. They mostly bashed the keyboard with a stone. When they did type, they produced five pages consisting almost entirely of the letter 'S'. They also urinated and defecated on the keyboard.
If you hand an average monkey a pencil and an empty book:
The probability is 0.
While mathematically, in an infinite timeframe with a random generator, it is theoretically non-zero (approx.