Podcast
Root Causes 453: It Turns Out Monkeys Couldn't Type Shakespeare After All
Hosted by
Jason Soroko
Fellow
Original broadcast date
January 2, 2025
The old adage states that a monkey in front of a keyboard, given enough time, could randomly type the works of Shakespeare. Apparently, someone ran the numbers and said not so much. We break it down and explain why we're discussing this on a PKI podcast.
Podcast transcript
Lightly edited for flow and brevity.
TCTim CallanAlright, so this is a fun one. You spotted an article in something called New Scientist, which is not a journal I'm familiar with. This was written by James Woodford, October 31, 2024. So Halloween day. Here's the headline, Chimpanzees Will Never Randomly Type the Complete Works of Shakespeare. So, in case anybody doesn't know this idea, what are they referencing here, Jason?
TCTim CallanHere's the subhead. The infinite monkey theorem states that illiterate primates could write great literature with enough time, but the amount of time needed is much longer than the lifespan of the universe. So basically, I think what someone did is they figured out how many keys were on a keyboard in an old fashioned typewriter - because it's going to be a little different on your computer - and then they came up with some kind of rate at which the monkeys would type. I don't know, a key per second, or whatever you come up with, and then they calculated the total number of combinations that it would require of those to get the complete works of Shakespeare and not surprisingly, it's a stratospherically large number. Like if you want to say, I don't know how many keys are on the keyboard, but if you count the shift, if you want to say you've got a total of 80 possible things you might type, then what you got to do is it's 80 to the first, 80 to the second, 80 to the third, 80 to the fourth, etc., and you count up the number of characters, including spaces in Shakespeare, and it's an awful lot. That's a big, big number. I'm not at all surprised that a monkey couldn't do that within the lifespan of the universe. But I imagine that's what was done. Is that your impression of what went on here?
TCTim CallanIt's just a fun exercise. But yes, I'm sure that number is just enormous.
TCTim CallanWhich is much longer than the expected lifespan of the universe by any current theory.
TCTim CallanNow there are some factors working in favor of the chimpanzees that I'm sure these people thought about, because presumably these are smart people, which is, for instance, you can tell the works of Shakespeare in any order as long as you type. So it's not just one combination. You don't have to start with the first play and end with the Tempest. You can do it in any order you want. So it gives you more outs, if you will.
If you go back to the original, there weren't any stage directions, and it's very traditional to put stage directions in, the most famous one being exit pursued by bear. But you don't need those. You could have them or have some and not others. That also gives you more outs. If you got something that was the complete works of Shakespeare, but one of the stage directions was apocryphal, or let's say misspelled, I could contend that you still met the qualification so that would open the door up to a lot more outs than you think you have. You have many more than one outs. Nonetheless, even accounting for all of that, you still have an absurdly difficult problem that has been made easier by such a tiny fraction that you can't even notice it.
If you go back to the original, there weren't any stage directions, and it's very traditional to put stage directions in, the most famous one being exit pursued by bear. But you don't need those. You could have them or have some and not others. That also gives you more outs. If you got something that was the complete works of Shakespeare, but one of the stage directions was apocryphal, or let's say misspelled, I could contend that you still met the qualification so that would open the door up to a lot more outs than you think you have. You have many more than one outs. Nonetheless, even accounting for all of that, you still have an absurdly difficult problem that has been made easier by such a tiny fraction that you can't even notice it.
TCTim CallanSo that says it all. That says it all. Now this is fun and interesting. And why are we discussing this on a cryptography podcast, Jason?
TCTim CallanAnd just attacks against RSA.
TCTim CallanI think for your average person who isn't thinking about it in these terms, the numbers can be deceptive. And I remember you and I talking years ago on this podcast about the problem that a bunch of CAs faced, where they had one bit too few of entropy in their serial number.
And you made the argument, which was correct, which is to say, look, this might not seem like much. Might say, ah, you went from 40 bits to 39 bits, what's the big deal? And the big deal is half your key space. And so, add one more character to Shakespeare, and if we say there's, again, 80 things you might be able to type on a traditional typewriter, add one more character in the end, and you just increased the total number of things you might need by 80. And so every time you do that, you increase it again, which is why the Curious George thing gets so crazy, so fast, and just the power of exponential expansion. I think for your average person who's not thinking about, I think for us intuitively, living our normal lives in the real world, there's a strong tendency not to really give credit kind of emotionally and off hand to the power of exponential expansion and how really crazy it is.
And you made the argument, which was correct, which is to say, look, this might not seem like much. Might say, ah, you went from 40 bits to 39 bits, what's the big deal? And the big deal is half your key space. And so, add one more character to Shakespeare, and if we say there's, again, 80 things you might be able to type on a traditional typewriter, add one more character in the end, and you just increased the total number of things you might need by 80. And so every time you do that, you increase it again, which is why the Curious George thing gets so crazy, so fast, and just the power of exponential expansion. I think for your average person who's not thinking about, I think for us intuitively, living our normal lives in the real world, there's a strong tendency not to really give credit kind of emotionally and off hand to the power of exponential expansion and how really crazy it is.
TCTim CallanThat's another thing where numbers, once numbers hit a certain size, they kind of all seem the same to us. Our intuitive minds are walking around in the physical world minds, and you hear people say things all the time. They'll say, you say, what's the chance of this happening? And they'll go, oh God, one in a million. I mean, like, it's probably 99% likely. And you're like, okay, well, you just said one in hundred and one in a million. They're completely different things. Which one is it? This kind of thing goes on all the time in people's minds, where 99% likelihood of success and one in a million chance of failure kind of get lumped together in the same bucket, and they're not remotely the same bucket. That's what's hard for all of us to really get these numbers and understand them correctly, kind of at an intuitive and emotional level.
TCTim CallanThen it also doesn't help that, when we're doing things just with powers, two to the 32nd versus two to the 33rd and you go, 32, 33 what's the difference. The difference, of course, is twice as much. That sort of thing doesn't help either.
TCTim CallanWe had to share it. We need to do a fun one. We're so heavy about stuff, once in a while we need to do a fun one. I'm glad we did a fun one.