Issue 34
March 2005

Now where's that typewriter?

The legendary image of an army of monkeys typing letters at random and eventually producing the works of Shakespeare seems to have gradually emerged over a long period of time. In Gulliver's Travels (1782) Jonathan Swift tells of a Professor of the Grand Academy of Lagado who aims to generate a catalogue of all scientific knowledge by having his students continuously generate random strings of letters by means of a mechanical printing device.

The first mechanical typewriter had been patented in 1714. After several 18th and 19th century French mathematicians used the example of a great book being composed by a random deluge of letters from a printing works as an example of extreme improbability, the monkeys appear first in 1909. The French mathematician Émile Borel suggests that the randomly typing monkeys would eventually produce every book in France9s Bibliothèque Nationale. Arthur Eddington took up the analogy in his famous book The Nature of the Physical World in 1928, where he changed the library in question in a not entirely unpredictable way: "If I let my fingers wander idly over the keys of a typewriter it might happen that my screed made an intelligible sentence. If an army of monkeys were strumming on typewriters they might write all the books in the British Museum."

Eventually this oft-repeated example homed in on the Complete Works of Shakespeare as the candidate for random recreation. And, intriguingly, there is now a website which simulates an ongoing random striking of typewriter keys and then does pattern searches against the Complete Works of Shakespeare to identify matching character strings. This simulation of the monkeys' actions began on 1st July 2003 with 100 monkeys and the population of monkeys has effectively doubled every few days ever since. They have produced more than 1035 pages, each requiring 2000 keystrokes.

• There are 80 possible keystrokes on most standard keyboards, so what is the chance of getting a pre-specified string of 10 characters correct?
• What is the probability of typing the two-letter word "as"?

No time to waste

To check how the monkeys are doing, see The Monkey Shakespeare Simulator. A running record is kept of daily and all-time record strings. The daily records are fairly stable, around the 18 or 19 character-string range, and the all-time record inches steadily upwards. For example, recently I saw that one of the 18-character strings that the monkeys have generated contains the snippet:

...Theseus. Now faire UWfIlaNWSK2d6L;wb...
The first 18 characters match part of an extract from A Midsummer Night's Dream that reads
...us. Now faire Hippolita, our nuptiall houre....
For a while the record string was 21 characters long, with
...KING. Let fame, that wtIA'"yh!"VYONOvwsFOsbhzkLH...
which matches the following 21 letters from Love's Labour's Lost:
...KING. Let fame, that all hunt after in their lives,
Live regist'red upon our brazen tombs, And then grace us in the disgrace of death;....

In December 2004, the record reached 23 characters with

...Poet. Good day Sir FhlOiX5a]OM,MlGtUGSxX4IfeHQbktQ...
which matched part of Timon of Athens
...Poet. Good day Sir Pain. I am glad y'are well.
Poet. I haue not seene you long, how goes the World?
Pain. It weares sir, as it growes....
But I can report that in January 2005, after 2,737,850 million billion billion billion monkey-years of random typing, the record has stretched to 24 characters, with
RUMOUR. Open your ears; 9r"5j5&?OWTY Z0d "B-nEoF.vjSqj[..."
which matches 24 letters from Henry IV Part 2 "RUMOUR. Open your ears; for which of you will stop
The vent of hearing when loud Rumour speaks?..."

Which all goes to show: it is just a matter of time!

Did you manage to answer the puzzle posed in Outer space: Racing certainties? If not, you can find the answer here!