Stay informed with the Stay informed with the
Recent Articles
Best of Donald Catlin

# Gaming Guru  ### All Deck Orderings - How Long Does It Take?

4 November 2002

I have a friend named Michael C. who is a Blackjack dealer at the Treasure Island Casino in Las Vegas.  Mickey, as I call him, has been dealing cards for about six years so he has shuffled thousands and thousands of decks.  In all of that time do you suppose Mickey has put the cards in every possible order?  Well, maybe that's asking a lot, but if we take all of the decks, in all of the casinos, in all of Nevada since gambling was legalized, then maybe, just maybe, all possible deck ordering have occurred.  Let's have a look.

The particular ordering of n objects is called a permutation on n objects.  The total number of such permutations is given by the number n!, read n factorial, and is calculated as follows:

 n! = n(n - 1)(n - 2) ... 3 x 2 x 1 (1)

For example 5! = 5 x 4 x 3 x 2 x 1 and is equal to 120.  Although we have looked at this before, let me remind you of the rationale for this answer.

Think of the cards as occupying 52 spaces:

 Space 1 Space 2 Space 3
|
|
|

 Space 50 Space 51 Space 52

There are 52 ways that one can place a card in Space 1.  This done there are 51 cards left that we can choose to place in Space 2.  Thus for each of the 52 choices in Space 1 there are 51 choices for Space 2, so altogether there are 52 x 51 ways to fill in the first two spaces.  For each of these choices there are 50 ways to fill in Space 3, so there are 52 x 51 x 50 ways to fill in the first three spaces.  Continuing in this fashion we see that the number of way to arrange a deck of 52 playing cards is indeed 52!  Just how big is this number?

If you try to calculate 52! by doing successive multiplications on your calculator, either you will get a message that the number is too big (an old calculator) or the calculator will shift into scientific notation.  You probably have a factorial key on your calculator (labeled !) and if you enter 52 you will see a number such as 8.0658 x 1067 .  This represents the number 80658000... where there are 63 zeros following the last 8.  Incidentally, before there were fancy calculators around one used a very accurate approximation to n! known as Stirling's Approximation.  It is:

 n! ~ [2 x pi x n]1/2(n/e) n (2)

where e is the natural logarithm base, approximately 2.71828.  I mention this because your calculator's software probably uses Stirling's Approximation when calculating factorials that have shifted to scientific notation.  For you math weenies like me out there, if you take the base 10 logarithm of both sides of (2) you can see where the 8.0658 x 1067 comes from when n = 52.

Very well. We know the number of orderings; now let's answer the question raised in the title of this article, namely, how long would it take to generate all such deck orderings?  To be generous, let us suppose that we have a very fast computer.  The size of a tiny hydrogen atom is larger than 10-8 centimeters, so let's imagine that technology has advanced to the point where a microprocessor of this size can be built (one hell of an assumption by the way).  An electromagnetic signal in this device traveling at the speed of light, 3 x 1010 centimeters per second, would take 10-8/(3 x 1010) or about 3 x 10-19 seconds to perform an operation.  It would take about 50 operations to produce one ordering (ignoring the time necessary to report the result), so the time per ordering is approximately 1.5 x 10-17 seconds.  There are 31,536,000 seconds in a year, or about 3.2 x 10-8 years per second, so here is the approximate number of years it would take this super fast computer to calculate the different deck arrangements:

(3.2 x 10-8 years/sec)(1.5 x 10-17 sec/operation)(8 x 1067operations) = 3.84 x 10 43 years

It is believed that our universe is far less than a trillion years old, that number being 1012 years.  If this super fast computer would have started operating at the beginning of our universe, it would have now computed only a minuscule fraction of the possible deck arrangements.  I don't know how to say it because I don't know any names for such small numbers, but the fraction would be much, much, much, much less than than one octillionth.  Hard to believe isn't it?

So Mick, keep shuffling, there are a lot more decks to go.

See you next month.

Recent Articles
Best of Donald Catlin
Donald Catlin Don Catlin is a retired professor of mathematics and statistics from the University of Massachusetts. His original research area was in Stochastic Estimation applied to submarine navigation problems but has spent the last several years doing gaming analysis for gaming developers and writing about gaming. He is the author of The Lottery Book, The Truth Behind the Numbers published by Bonus books.

#### Books by Donald Catlin:

Lottery Book: The Truth Behind the Numbers
Donald Catlin
Don Catlin is a retired professor of mathematics and statistics from the University of Massachusetts. His original research area was in Stochastic Estimation applied to submarine navigation problems but has spent the last several years doing gaming analysis for gaming developers and writing about gaming. He is the author of The Lottery Book, The Truth Behind the Numbers published by Bonus books.

#### Books by Donald Catlin:

Lottery Book: The Truth Behind the Numbers