Tom Stoppard's absurdist play *Rosencrantz and Guildenstern Are Dead* begins with one of them, Guildenstern (or is it Rosencrantz?), flipping coins. "Heads," Rosencrantz says, and takes the coin. Guildenstern flips again. "Heads," Rosencrantz says, and takes the coin. Another flip. "Heads." Again, "Heads." Soon we find out that Guildenstern has flipped 76 coins, and all of them have come up heads. "A weaker man, he remarks, might be moved to re-examine his faith, if in nothing else at least in the law of probability."

As they keep flipping coins and Rosencrantz's purse continues to grow, Guildenstern concludes that there are several possible explanations for the extremely unlikely run of heads:

"One: I'm willing it. Inside where nothing shows, I am the essence of a man spinning double-headed coins, and betting against himself in private atonement for an unremembered past

"Two: time has stopped dead, and the single experience of one coin being spun once has been repeated ninety times

"Three: divine intervention, that is to say, a good turn from above concerning him, cf. children of Israel, or retribution from above concerning me, cf. Lot's wife

"Four: a spectacular vindication of the principle that each individual coin spun individually is as likely to come down heads as tails and therefore should cause no surprise each individual time it does."

When I watched this scene (during an excellent production of the play at my university), I wondered what the odds were. Is it likely that anyone in the world has flipped heads 76 times in a row on a fair coin? I don't have very good intuition about big numbers, so I didn't really know which way it should go. On the one hand, it's extremely unlikely that any individual run of 76 coins is all heads. On the other hand, 7 billion is a lot of people. Are they all flipping coins? Probably not, but some of them are. If I flip a coin 76 times, there are a total of 2^{76} different strings of heads and tails I could get, and only one of them is all heads. Wolfram Alpha tells me that 2^{76} is about 7.510^{22}, so the chances of getting 76 heads in a row is about 1.310^{-23}, which is much closer to 0 than it is to 1 in 7 billion. Even if everyone in the world has flipped coins at least 76 times, there's almost no chance that anyone's last 76 flips have all been heads.

So what *is* the longest string of heads that it's likely that anyone in the world has seen, assuming that they are flipping fair coins that have a 50/50 chance of coming up heads on any individual flip? There isn't one clear answer to that. We have to make some assumptions about coin flippers and some choices about how to define the question.

We could ask what is the largest number *n* such that someone is likely to have flipped *n* heads in his or her last *n* coin flips. In other words, what is the longest currently running string of heads? That problem is fairly simple: there is a 1 in 2^{n} chance of getting *n* consecutive heads in *n* flips. We do need to decide how many people in the world flip coins on a regular basis. I don't know much about coin flipping in other cultures, but I'm going to guess that there are no more than a billion habitual coin flippers out there. A billion is probably an overestimate, but it's a nice round number, so I'm going with it. We want to find out what *n* makes 2^{n} approximately equal to 1 billion, and it turns out that 30 is pretty darn close. If there are a billion people who have flipped coins at least 30 times, then it's not too surprising if one of them has flipped 30 heads in the past 30 flips.

On the other hand, maybe we want to ask what is the longest string of heads anyone has ever seen. So instead of asking whether the last 30 flips have been heads, we're asking whether anyone who has flipped a coin say, 100 times, has ever seen a string of 30 heads. That's a lot more likely: the likelihood of getting a string of 30 heads in a row somewhere in your 100 flips is about 1 in 30 million. If there are at least 30 million people in the world who have flipped a coin 100 times, it shouldn't be surprising if one of them has flipped 30 heads in a row at some point. If we assume that there are a billion people who have flipped coins at least 100 times, we can see that it wouldn't be too surprising for one of them to have a string of 35 heads in a row somewhere in there. 76 (or 90, Rosencrantz's eventual run) heads in a row is much less likely. If you flip a coin 500 times, there's only a 1 in 3.510^{20} chance of getting a string of 76 heads. It's a thousand times more likely than having the *last* 76 flips be heads, but it's still incredibly unlikely.

A related question is how many times Rosencrantz and Guildenstern would have to flip coins to *expect* to get a run of 90 heads at some point in their flips. The length of the longest string you should expect (pdf) grows quite slowly compared to the total number of flips of the coin. In the case of 100 coin flips, the approximate expected length of the longest run of heads is 6. For 1000 flips, the expected length of the longest run only increases to 9. I played around with the numbers a bit and found that if you flipped a coin 2,000,000,000,000,000,000,000,000,000, or 210^{27}, times, you should expect your longest run of heads to be around 90. Perhaps *Rosencrantz and Guildenstern Are Dead* is just a snapshot in the epic story of two men who are flipping a coin a second for billions of times as long as the universe has been around.

After crunching the numbers, I am convinced that no one in the world has ever flipped heads 76 or 90 times in a row on a fair coin, as Rosencrantz and Guildenstern did in the play. But that's the magic of theater, I suppose. Of course, Stoppard never gives us a reason for Rosencrantz's incredible success. He and Guildenstern do, however, use their logic-defying luck to win a few bets with "the player," the leader of a traveling troupe of actors. After the player storms off, Rosencrantz looks at the last coin he flipped and says, "I saythat was lucky...it was tails."

*If you'd like to read more about flipping coins and probability, check out my post on the topic at the Blog on Math Blogs.*