Science

Can you solve it? The infinite monkey theorem

• Bookmarks: 6


The infinite monkey theorem states that if you let a monkey hit the keys of a typewriter at random an infinite amount of times, eventually the monkey will type out the entire works of Shakespeare.

Today’s puzzle involves a monkey typing out something a little shorter.

The magic word

A monkey is sat at a typewriter that has only 26 keys, one per letter of the alphabet. The monkey types at random, with a constant speed of one letter per second. It favours no letters: all letters at any second have a 1/26 probability of being typed.

Which of the following is greater?

a) the average time it will take the monkey to type “abracadabra”

b) the average time it will take the monkey to type “abracadabrx”

This is not a trick question. The word ‘abracadabra’ has 11 letters, and therefore has a probability of (1/26)11 of appearing during any 11 second spell. Likewise, the word ‘abracadabrx’ has 11 letters, and also has a probability of (1/26)11 of appearing during any 11 second spell. Yet this observation does not entail that they will occur on average after the same amount of time.

(The question is NOT asking which word the monkey will type first. The question is asking what will happen in the long run. Imagine that the monkey has been typing for such a long time that both ‘abracadabra’ and ‘abracadabrx’ have appeared many times; on average, how long did it it take the monkey to type each of these words?)

I’ll be back at 5pm UK with the answer.

PLEASE NO SPOILERS Instead reminisce about your favourite typewriters, or tell me an interesting fact about monkeys.

UPDATE: To read the solution click here.

I read today’s puzzle in The Price of Cake: And 99 Other Classic Mathematical Riddles, by Clément Deslandes and Guillaume Deslandes, an excellent collection which appeared a few years ago in France and has recently been translated into English. If you like mathematical puzzles, but want to go further into the maths behind them, the book has a useful end section that discusses some of the concepts involved.

I set a puzzle here every two weeks on a Monday. I’m always on the look-out for great puzzles. If you would like to suggest one, email me.

I give school talks about maths and puzzles (online and in person). If your school is interested please get in touch.

CLARIFICATION: A reader has emailed me to say that the question is ambiguously phrased. When I say ‘the average time it will take the monkey to type abracadabra’, I do not mean how long it takes to type out the word ‘abracadabra’ on its own, which is always 11 seconds (or 10 seconds since the first letter is typed on zero seconds and the 11th letter is typed on the 10th second.) I mean the average of the time it takes to get to an ‘abracadabra’, either from the beginning of the experiment or from a previous appearance of ‘abracadabra’. Another way of phrasing the question would be: over the long run, which of ‘abracadabra’ or ‘abracadabrx’ appears more frequently? The one that is more frequent is the one it takes, on average, less time to get to.

FURTHER CLARIFICATION: If the monkey types ‘abracadabracadabra’ this only counts as one ‘abracadabra’. Likewise, ‘abracadabrabracadabra’ is only one ‘abracadabra’. In other words, you need to type the word ‘abracadabra’ completely, and that counts as one appearance, and then you need to type it completely again for the next appearance.

This post was originally published on this site

6 recommended
0 views
bookmark icon