# Odds concerning monkeys and the lottery

**URL:** <https://boards.straightdope.com/t/odds-concerning-monkeys-and-the-lottery/225544>\
**Category:** Factual Questions\
**Created:** [January 22, 2004, 1:06am UTC](https://boards.straightdope.com/t/odds-concerning-monkeys-and-the-lottery/225544 "2004-01-22T01:06:30Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![With\_Rye](https://avatars.discourse-cdn.com/v4/letter/w/838e76/32.png) [@With\_Rye](https://boards.straightdope.com/u/With_Rye)\
**Post date:** [January 22, 2004, 1:06am UTC](https://boards.straightdope.com/t/odds-concerning-monkeys-and-the-lottery/225544/1 "2004-01-22T01:06:30Z")

</div>

I am really awful when it comes to statistics and tend to stay away from rather than try to understand it. But this, of course, doesn’t work and now I’m plagued with this annoying curiousity about everyday topics dealing with the topic I can’t seem to ignore.

For instance, are the odds of a lottery machine popping out the numbers (in order) 1 2 3 4 5 6 the same as any other number sequence? Surely, “1” has an equal chance coming out for the first slot as any number, and “2” the second slot, and so on. Unless each slot has some sort of dependency on another slot to determine which number comes out, but I don’t see how this can be. Or I am just ignorant of what’s happening. I remember vaguely about “mutual exclusiveness” from high school but I still haven’t made sense of it. I ask because my philosophy teacher told the class a lottery ticket with an ordered sequence is just as likely as a ticket with a seemingly random one to win (or lose, if you prefer).

If that is true, then won’t the assertion that a roomful of monkeys typing away on typewriters will eventually produce _Hamlet_ also hold? Each letter has an even chance of being struck (assuming nonbiased monkeys with no developed preference for certains key combinations, of course). Can we then say that event will just as likely happen as any other? That seems sort of…wrong, at least non-intuitive, to me.

ACK, deliver me!

---

<div class="post-metadata">

**Author:** ![aahala](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@aahala](https://boards.straightdope.com/u/aahala)\
**Post date:** [January 22, 2004, 1:14am UTC](https://boards.straightdope.com/t/odds-concerning-monkeys-and-the-lottery/225544/2 "2004-01-22T01:14:01Z")

</div>

Any sequence of numbers is just as likely(unlikely) as another. It’s we, not the bin the balls are in, who place significance on the outcome.

---

<div class="post-metadata">

**Author:** ![El\_Zagna](https://avatars.discourse-cdn.com/v4/letter/e/d2c977/32.png) [@El\_Zagna](https://boards.straightdope.com/u/El_Zagna)\
**Post date:** [January 22, 2004, 1:23am UTC](https://boards.straightdope.com/t/odds-concerning-monkeys-and-the-lottery/225544/3 "2004-01-22T01:23:09Z")

</div>

> [@With Rye](#):
>
> For instance, are the odds of a lottery machine popping out the numbers (in order) 1 2 3 4 5 6 the same as any other number sequence?

Yep, and welcome to the boards.

> [@With Rye](#):
>
> If that is true, then won’t the assertion that a roomful of monkeys typing away on typewriters will eventually produce _Hamlet_ also hold?

Yep, given an infinite number of monkeys or one monkey with an infinite amount of time.

Each of these questions seems to be trying to come to terms with some of the non-intuitive properties of very large numbers or very remote possibilities. When dealing with an infinite number of possibilities, things that appear unlikely become - not just likely - but certain.

---

<div class="post-metadata">

**Author:** ![Lockfist](https://avatars.discourse-cdn.com/v4/letter/l/838e76/32.png) [@Lockfist](https://boards.straightdope.com/u/Lockfist)\
**Post date:** [January 22, 2004, 1:30am UTC](https://boards.straightdope.com/t/odds-concerning-monkeys-and-the-lottery/225544/4 "2004-01-22T01:30:12Z")

</div>

> [@With Rye](#):
>
> …
> 
> If that is true, then won’t the assertion that a roomful of monkeys typing away on typewriters will eventually produce _Hamlet_ also hold? Each letter has an even chance of being struck (assuming nonbiased monkeys with no developed preference for certains key combinations, of course). Can we then say that event will just as likely happen as any other? That seems sort of…wrong, at least non-intuitive, to me.
> 
> ACK, deliver me!

This was actually attempted (to a small degree) - see the results [here](http://www.vivaria.net/experiments/notes/publication/). Back story [here](http://www.vivaria.net/experiments/notes/documentation/).

---

<div class="post-metadata">

**Author:** ![Hermitian](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/hermitian/32/470_2.png) [@Hermitian](https://boards.straightdope.com/u/Hermitian)\
**Post date:** [January 22, 2004, 4:36am UTC](https://boards.straightdope.com/t/odds-concerning-monkeys-and-the-lottery/225544/5 "2004-01-22T04:36:42Z")

</div>

Concerning the monkeys, in “theory” it can happen, but in reality, no. I jumped on this question because I just recently worked a problem with monkeys and Hamlet in my statistics class.  
(Note for the following: Yes I know typing out lots of zeros is not good scientific practice, but sometimes it helps get the idea across the magnitude of larger numbers.)  
According the my statistics book, the chances of Hamlet being typed out by 10,000,000,000 monkey, hitting 10 keys per second, for the age of the universe, which is 1,000,000,000,000,000,000 seconds, would be:

1 against 10^164345

10^164345 is an awesomely hugely unfathomable number (Over 164,300 digits long!!). My books proceeds to state that the whole monkeys and Hamlet business is complete and utter “nonsense.”

---

<div class="post-metadata">

**Author:** ![Electronic\_Chaos](https://avatars.discourse-cdn.com/v4/letter/e/bbe5ce/32.png) [@Electronic\_Chaos](https://boards.straightdope.com/u/Electronic_Chaos)\
**Post date:** [January 22, 2004, 4:56am UTC](https://boards.straightdope.com/t/odds-concerning-monkeys-and-the-lottery/225544/6 "2004-01-22T04:56:47Z")

</div>

_hands OP the Heart of Gold_😃

---

<div class="post-metadata">

**Author:** ![Sublight](https://avatars.discourse-cdn.com/v4/letter/s/439d5e/32.png) [@Sublight](https://boards.straightdope.com/u/Sublight)\
**Post date:** [January 22, 2004, 8:11am UTC](https://boards.straightdope.com/t/odds-concerning-monkeys-and-the-lottery/225544/7 "2004-01-22T08:11:17Z")

</div>

As others have already said, the odds against randomly producing something as long as Hamlet are too big to be pictured in any practical way. Try thinking of it this way: a monkey hitting a typewriter (or a computer spewing out random letters, same thing) once every second will eventually produce your first name. If your name is Ed, the chance of a perfect match is 1 in 26[sup]2[/sup], or 676, which means you’ll probably see your name come out in only 10 minutes or so. If it’s Bob, the chance is 1 in 26[sup]3[/sup], or 17576, which will take a few hours. Dave (26[sup]4[/sup], or 456976) will have to wait about 5 days. If your name is Yoshitsune, the chances are 1 in 26[sup]10[/sup], or 141167095653376, which means you’ll have to wait roughly 4 million years for it to come up, but eventualy it will.

---

<div class="post-metadata">

**Author:** ![muttrox](https://avatars.discourse-cdn.com/v4/letter/m/a8b319/32.png) [@muttrox](https://boards.straightdope.com/u/muttrox)\
**Post date:** [January 22, 2004, 3:33pm UTC](https://boards.straightdope.com/t/odds-concerning-monkeys-and-the-lottery/225544/8 "2004-01-22T15:33:47Z")

</div>

> [@Hermitian](#):
>
> My books proceeds to state that the whole monkeys and Hamlet business is complete and utter “nonsense.”

Your books are categorically wrong. The premise is an _infinite_ amount of monkeys, with _infinite_ time. Your example uses finite numbers of monkey a finite time limit, completely different.

---

<div class="post-metadata">

**Author:** ![muttrox](https://avatars.discourse-cdn.com/v4/letter/m/a8b319/32.png) [@muttrox](https://boards.straightdope.com/u/muttrox)\
**Post date:** [January 22, 2004, 3:35pm UTC](https://boards.straightdope.com/t/odds-concerning-monkeys-and-the-lottery/225544/9 "2004-01-22T15:35:02Z")

</div>

Also note that even in your example, the monkeys did produce Hamlet, it just took a very very long time.

---

<div class="post-metadata">

**Author:** ![ccwaterback](https://avatars.discourse-cdn.com/v4/letter/c/df705f/32.png) [@ccwaterback](https://boards.straightdope.com/u/ccwaterback)\
**Post date:** [January 22, 2004, 8:55pm UTC](https://boards.straightdope.com/t/odds-concerning-monkeys-and-the-lottery/225544/10 "2004-01-22T20:55:24Z")

</div>

What’s the old saying? “There’s lies, damn lies, and statistics”. Any time you deal with statistics, you have to qualify your realm as either “practical” or “theory”. For instance, the monkey example is so unlikely that in all practicality the probability is zero, but in theory, it can be done. In the classroom and academia, some results can be shown to be highly unlikely, but statistically possible. In engineering and the “real-world” most of those highly unlikely probabilities are “rounded” to zero.

---

<div class="post-metadata">

**Author:** ![MikeS](https://avatars.discourse-cdn.com/v4/letter/m/919ad9/32.png) [@MikeS](https://boards.straightdope.com/u/MikeS)\
**Post date:** [January 22, 2004, 9:28pm UTC](https://boards.straightdope.com/t/odds-concerning-monkeys-and-the-lottery/225544/11 "2004-01-22T21:28:41Z")

</div>

But wouldn’t an infinite number of monkeys immediately produce not only “Hamlet”, but all the works of Shakespeare, and every other work of literature, past and future? 🙂

---

<div class="post-metadata">

**Author:** ![SCSimmons](https://avatars.discourse-cdn.com/v4/letter/s/e495f1/32.png) [@SCSimmons](https://boards.straightdope.com/u/SCSimmons)\
**Post date:** [January 22, 2004, 10:05pm UTC](https://boards.straightdope.com/t/odds-concerning-monkeys-and-the-lottery/225544/12 "2004-01-22T22:05:15Z")

</div>

[http://www.brunching.com/randommonkeys.html](http://www.brunching.com/randommonkeys.html)

---

<div class="post-metadata">

**Author:** ![Chronos](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/chronos/32/134_2.png) [@Chronos](https://boards.straightdope.com/u/Chronos)\
**Post date:** [January 22, 2004, 10:08pm UTC](https://boards.straightdope.com/t/odds-concerning-monkeys-and-the-lottery/225544/13 "2004-01-22T22:08:25Z")

</div>

In fact, an infinite number of monkeys would not only produce every work of literature, past, present, and future, but they would produce an infinite number of copies of each.

Project Gutenberg’s full text of _Hamlet_ weighs in at 206 KB, at one byte per character. Assuming, for simplicity, that the only characters are the 26 letters of the alphabet, that means that the odds of a given 206,000 character sequence being _Hamlet_ are 1 in 26[sup]206000[/sup], which is approximately 10[sup]291484[/sup]. So if you had that many monkeys, you’d expect to get one copy of _Hamlet_ out.

---

<div class="post-metadata">

**Author:** ![ultrafilter](https://avatars.discourse-cdn.com/v4/letter/u/3d9bf3/32.png) [@ultrafilter](https://boards.straightdope.com/u/ultrafilter)\
**Post date:** [January 22, 2004, 10:12pm UTC](https://boards.straightdope.com/t/odds-concerning-monkeys-and-the-lottery/225544/14 "2004-01-22T22:12:44Z")

</div>

The probability that the monkeys will produce Hamlet is 1, but they are not guaranteed to do so. It’s a feature of standard probability theory that, when there is an infinite number of possible outcomes, some events may have probability 0 and still occur.

There has been work in a non-standard probability theory where this doesn’t happen, but it hasn’t reached widespread acceptance yet.

---

<div class="post-metadata">

**Author:** ![NurseCarmen](https://avatars.discourse-cdn.com/v4/letter/n/5daacb/32.png) [@NurseCarmen](https://boards.straightdope.com/u/NurseCarmen)\
**Post date:** [January 22, 2004, 10:32pm UTC](https://boards.straightdope.com/t/odds-concerning-monkeys-and-the-lottery/225544/15 "2004-01-22T22:32:11Z")

</div>

I always thought it was more of a commentary on infinity, so lay people could wrap their head around the immensity of it.

Either that, or it was a knock against Willy S.

---

<div class="post-metadata">

**Author:** ![Flash-57](https://avatars.discourse-cdn.com/v4/letter/f/839c29/32.png) [@Flash-57](https://boards.straightdope.com/u/Flash-57)\
**Post date:** [January 23, 2004, 7:08am UTC](https://boards.straightdope.com/t/odds-concerning-monkeys-and-the-lottery/225544/16 "2004-01-23T07:08:07Z")

</div>

See now, the question of monkeys and typewriters can be greatly simplified with a little bit of editing. Every time a monkey types a letter, check to see if the letter is the corrent next letter from Hamlet. If not, make the monkey erase the letter and type another.

Actually, you could create Hamlet pretty fast with just one monkey and a computer to erase incorrect characters.

And, you wouldn’t need a monkey–a random number generator would work better. It wouldn’t be that hard to write a simple script to test this theory.

Anyone know how many letters (include punctuation) in Hamlet?

Let’s say there are 10,000 letters in Hamlet (a number I pulled from thin air). Each letter would need an average of 47 guesses (there are 94 characters on my keyboard) to guess it. So, that’s about a half million guesses. My computer could do that in a day or so.

---

<div class="post-metadata">

**Author:** ![Xema](https://avatars.discourse-cdn.com/v4/letter/x/9de053/32.png) [@Xema](https://boards.straightdope.com/u/Xema)\
**Post date:** [January 23, 2004, 7:37am UTC](https://boards.straightdope.com/t/odds-concerning-monkeys-and-the-lottery/225544/17 "2004-01-23T07:37:13Z")

</div>

> [@Flash-57](#):
>
> See now, the question of monkeys and typewriters can be greatly simplified with a little bit of editing. Every time a monkey types a letter, check to see if the letter is the corrent next letter from Hamlet…
> 
> … that’s about a half million guesses. My computer could do that in a day or so.

So we can expect to get _Hamlet_ merely by providing a copy of _Hamlet_?

Impressive, sure, but perhaps not a miracle of modern technology.

---

<div class="post-metadata">

**Author:** ![PookahMacPhellimey](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/pookahmacphellimey/32/3175_2.png) [@PookahMacPhellimey](https://boards.straightdope.com/u/PookahMacPhellimey)\
**Post date:** [January 23, 2004, 12:00pm UTC](https://boards.straightdope.com/t/odds-concerning-monkeys-and-the-lottery/225544/18 "2004-01-23T12:00:17Z")

</div>

> [@Sublight](#):
>
> If your name is Yoshitsune, the chances are 1 in 26[sup]10[/sup], or 141167095653376, which means you’ll have to wait roughly 4 million years for it to come up, but eventualy it will.

I’m very bad at judging these things, but I wonder if it must necessarily come up in the given timeframe. Isn’t this just and average and couldn’t Yoshitsune be unlucky and have to wait much longer than the 4 million years?

Even more interesting is the question of whether the name Yoshitsune MUST come up given an eternity of random generating. Is it in the nature of what eternity is that this HAS to happen? Or is there a really really incredibly slim chance that “Yoshitsune” never comes up?

---

<div class="post-metadata">

**Author:** ![pjd](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/pjd/32/3009_2.png) [@pjd](https://boards.straightdope.com/u/pjd)\
**Post date:** [January 23, 2004, 1:15pm UTC](https://boards.straightdope.com/t/odds-concerning-monkeys-and-the-lottery/225544/19 "2004-01-23T13:15:11Z")

</div>

[Here](http://user.tninet.se/~ecf599g/aardasnails/java/Monkey/webpages/index.html)is a link to a monkey shakespeare simulator …

---

<div class="post-metadata">

**Author:** ![muttrox](https://avatars.discourse-cdn.com/v4/letter/m/a8b319/32.png) [@muttrox](https://boards.straightdope.com/u/muttrox)\
**Post date:** [January 23, 2004, 5:12pm UTC](https://boards.straightdope.com/t/odds-concerning-monkeys-and-the-lottery/225544/20 "2004-01-23T17:12:13Z")

</div>

> [@Flash-57](#):
>
> Actually, you could create Hamlet pretty fast with just one monkey and a computer to erase incorrect characters.

If you’re going to change the rules, why stop there? Let’s postulate a copy of Hamlet and and a xerox machine. Or a computer that has Hamlet as a word document… look, all I do is hit print!

[Next page](https://boards.straightdope.com/t/odds-concerning-monkeys-and-the-lottery/225544.md?page=2)
