taocp

This site has no text of the book. Keep your own copy of TAOCP next to it. See what is checked.

Exercise · Volume 1 · 1.2.5-1

Exercise 1.2.5-1

proved in Lean solution written

Rating00
KindK3, find a value: compute a number, a set or a closed form from the written solution
SectionSection 1.2.5 of Volume 1. Companion chapter: Permutations and factorials

The task

Count the orders in which a deck of 52 different cards can lie.

The exact wording is in your copy of the book.

Hints

Open one hint at a time. Try the exercise again after each.

Hint 1

Section 1.2.5 counts the orders of nn distinct objects: see eq. (4) and the choice of the places one by one.

Hint 2

Fill the places from the top. Count the cards that remain for each place.

Solution

Show the solution

The top place takes any of the 52 cards. The second place takes any of the 51 cards that are left. Each further place has one choice less, and the last place has one choice. The number of orders is the product of the choices:

52⋅51⋅50⋯2⋅1=52!52 \cdot 51 \cdot 50 \cdots 2 \cdot 1 = 52!

The value is

52!=80 658 175 170 943 878 571 660 636 856 403 766 975 289 505 440 883 277 824 000 000 000 000.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 decimal digits and it is about 8.07×10678.07 \times 10^{67}.

Check

For 3 cards the same rule gives 3!=63! = 6 orders, the list of eq. 1.2.5(1). Python gives math.factorial(52) as the number above, and len(str(math.factorial(52))) is 68. A second test: log⁡1052!=67.9068…\log_{10} 52! = 67.9068\ldots, so the number has 67+1=6867 + 1 = 68 digits and starts with 100.9068=8.0710^{0.9068} = 8.07.

Remarks

A fair shuffle picks one of these orders with probability 1/52!1/52!. The count is so large that a well shuffled deck is, with near certainty, in an order that has never occurred before. The general rule is in Section 1.2.5 of C1.

This solution is checked, and a person has not reviewed it yet. The source.

In Lean

proved The statement and its proof are in Lean. The kernel accepts the proof, and it uses the standard axioms only.

The status is computed from the Lean build. The node of the map.

Something is wrong? Report it.