Infinite Monkey Theorem - Maple Programming Help

Online Help

All Products    Maple    MapleSim

Home : Support : Online Help : Math Apps : Probability and Statistics : Probability : MathApps/TheInfiniteMonkeyTheorem

Infinite Monkey Theorem

Main Concept

The Infinite Monkey Theorem is a popular demonstration of mathematical probability, stating that


A monkey hitting keys at random on a typewriter keyboard, given enough time and typewriters, will reproduce the entire works of Shakespeare.


In mathematical terms, the text typed by a monkey for an infinite period of time can be interpreted as an infinite string with uniformly chosen random characters. The probability that a finite substring of length k  does not occur in the first n blocks of k characters is


assuming a keyboard with 26 different keys. As n, the probability that a monkey fails to reproduce any text of finite length k is


limn∞1126kn assuming k>0 = 0 


The following demonstration generates random strings of characters and attempts to build sentences containing pre-defined types of words. Experiment with the sentence structure and see how many sensible sentences you can generate. Use the "Word complexity" slider to influence the chance of generating longer strings.


Sentence structure:



Number of attempted sentences


Word complexity













More MathApps



Download Help Document

Was this information helpful?

Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam