52 factorial explained
Pick up a deck of cards, shuffle it well, and look at it: you are almost certainly the first person in history to see the cards in that order. The reason is a single number, 52 factorial, so large that the whole history of the universe is far too short to work through more than a vanishing sliver of it.
Counting the orders of a deck
An order of the deck is a list of its 52 cards from top to bottom. Build one spot by spot: the top card can be any of the 52, the second any of the 51 left, the third any of the 50 after that. Every choice for one spot combines with every choice for the next, so the counts multiply: 52 × 51 × 50 × … × 2 × 1. Mathematicians write this product as 52! and say "52 factorial". The same reasoning counts the arrangements of anything: 3 books on a shelf can stand in \(3 ! = 6\) orders, 10 runners can finish a race in \(10 ! = 3{,}628{,}800\) orders. Arrangements like these are called permutations.
The number itself
\[52 ! = 80{,}658{,}175{,}170{,}943{,}878{,}571{,}660{,}636{,}856{,}403{,}766{,}975{,}289{,}505{,}440{,}883{,}277{,}824{,}000{,}000{,}000{,}000\,.\]
It has 68 digits: an 8 followed by 67 more, about \(8.07 \times 10^{67}\). The twelve zeros at the end come from the twelve factors of 5 among 1 to 52 (one each from 5, 10, … 50, and an extra one from 25 and from 50), each paired with one of the many factors of 2 to make a 10. With two jokers the deck has
\[54 ! \approx 2.3 \times 10^{71}\]
orders, almost three thousand times as many.
How big that is
Since the Big Bang, 13.8 billion years ago, about \(4.4 \times 10^{17}\) seconds have passed. There are perhaps \(7.5 \times 10^{18}\) grains of sand on all the beaches of the world and around \(10^{23}\) stars in the observable universe. The Earth is made of about \(1.3 \times 10^{50}\) atoms and the Sun of about \(10^{57}\). 52! is tens of billions of times the number of atoms in the Sun. It is not infinite, and a computer can write it out in a moment, but no process in the history of the universe could have gone through its orders one by one.
Every shuffle in history
Around 117 billion people have ever lived. Imagine each of them shuffling a deck once a second, not just for a lifetime but for the entire age of the universe: about \(5.1 \times 10^{28}\) shuffles. Divide by 52! and you find that this impossible effort would have produced less than one in \(10^{39}\) of all the orders, less than one in a trillion trillion trillion. The gap opens early: the first 18 cards alone can be arranged in
\[52 \times 51 \times \dots \times 35 \approx 2.7 \times 10^{29}\]
ways, already more than all those shuffles.
Could two shuffles ever have matched?
Seeing any one particular order is hopeless, but what about two shuffles that happen to agree? This is the birthday problem: in a room of only 23 people, two probably share a birthday, because the number of pairs grows with the square of the number of people. Among N random shuffles of P possible orders there are about \(N^{2} / 2\) pairs, each matching with chance \(1 / P\), so the chance of a repeat is about \(1 - \e^{-N²/2P}\). For history's \(5 \times 10^{28}\) shuffles that is about \(1.6 \times 10^{-11}\): no two well-shuffled decks are ever likely to have been alike. Only with about \(\sqrt{52 !} \approx 10^{34}\) shuffles would a repeat become likely.
Fair shuffles and real ones
The argument needs a good shuffle. A computer does it with the Fisher–Yates shuffle: for each spot in turn, pick one of the remaining cards uniformly at random, which gives every one of the n! orders exactly the same chance. Hands do worse. A new deck comes in a fixed order, and a riffle shuffle only interleaves two packets, so a few riffles leave long runs of the original order. Dave Bayer and Persi Diaconis showed in 1992 that it takes about seven riffle shuffles to make a deck close to random. Seven good riffles, and the deck in your hands is one of a kind.
How fast factorials grow
Each factorial is the one before times the next number, so factorials outgrow any power: 10! is 3.6 million, 20! already \(2.4 \times 10^{18}\), and 52! has 68 digits. Stirling's formula,
\[n ! \approx \sqrt{2 \pi n} (n / e)^{n}\,,\]
estimates them closely; for 52 it is off by only 0.16 %. That is why a small deck behaves so differently from a full one: 24 cards have \(6.2 \times 10^{23}\) orders, few enough that history's shuffles would have shown each of them tens of thousands of times, while 52 cards put the same effort out of reach by a factor of \(10^{39}\).
Explore it
Open 52 Factorial to watch a deck shuffled spot by spot, each spot showing how many choices it has, while a scale of powers of ten climbs past the stars and every shuffle in history. Change who shuffles, how fast and for how long, try a deck with jokers, a euchre deck, one suit or five cards, and see where the orders overtake history.
Frequently asked questions
How many ways can a deck of 52 cards be arranged?
52! = 80,658,175,170,943,878,571,660,636,856,403,766,975,289,505,440,883,277,824,000,000,000,000, about 8.07 × 10⁶⁷. The first card can be any of 52, the second any of the remaining 51, and so on, and the counts multiply.
Is 52 factorial larger than the number of atoms in the universe?
No. The observable universe holds about 10⁸⁰ atoms, far more than 8 × 10⁶⁷. But 52! is larger than the number of atoms in the Earth (about 10⁵⁰) or in the Sun (about 10⁵⁷), and some estimates put the atoms of the whole Milky Way in the same range as 52!.
What is a factorial?
n factorial, written n!, is the product of the whole numbers from 1 to n: 4! = 4 × 3 × 2 × 1 = 24. It counts the orders in which n different things can be arranged. By convention 0! = 1, since there is exactly one way to arrange nothing.
Does it matter how I shuffle?
Yes. The uniqueness argument assumes every order is equally likely. A deck fresh from the box shuffled once or twice is still close to its starting order and may well repeat someone else's. About seven riffle shuffles make a deck close to random; overhand shuffling needs far more.
Ready to try it?
Open PictorX in your browser — no install, no credit card required to start.
Open 52 Factorial