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-6

Exercise 1.2.5-6

proved in Lean solution written

Rating17
Markersrecommended
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

Write 20!20! as a product of powers of primes, using Legendre's rule, eq. (8).

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

The primes that divide 20!20! are the primes up to 2020. Eq. (8) gives the exponent of each.

Hint 2

For each prime pp add ⌊20/p⌋+⌊20/p2⌋+⋯\lfloor 20/p \rfloor + \lfloor 20/p^2 \rfloor + \cdots until the terms are 00. Divide the previous term by pp and drop the remainder.

Solution

Show the solution

The primes up to 20 are 2,3,5,7,11,13,17,192, 3, 5, 7, 11, 13, 17, 19. Eq. (8) gives these exponents.

pp terms ⌊20/pk⌋\lfloor 20/p^k \rfloor exponent
2 10+5+2+110 + 5 + 2 + 1 18
3 6+26 + 2 8
5 44 4
7 22 2
11 11 1
13 11 1
17 11 1
19 11 1

For p=2p = 2: 20/2=1020/2 = 10, then 10/2=510/2 = 5, then 5/2→25/2 \to 2, then 2/2=12/2 = 1, then 1/2→01/2 \to 0. For p=3p = 3: 20/3→620/3 \to 6, then 6/3=26/3 = 2, then 2/3→02/3 \to 0. Therefore

20!=218⋅38⋅54⋅72⋅11⋅13⋅17⋅19.20! = 2^{18} \cdot 3^8 \cdot 5^4 \cdot 7^2 \cdot 11 \cdot 13 \cdot 17 \cdot 19.

Check

Multiply out: 218=2621442^{18} = 262144, 38=65613^8 = 6561, 54=6255^4 = 625, 72=497^2 = 49, and 11⋅13⋅17⋅19=4618911 \cdot 13 \cdot 17 \cdot 19 = 46189. The product is 2 432 902 008 176 640 000=20!2\,432\,902\,008\,176\,640\,000 = 20!. Python's sympy.factorint(math.factorial(20)) returns the same exponents.

Remarks

The number of trailing zeros of 20!20! is the exponent of 55, which is 44. Exercise 1.2.5-12 gives the closed form (n−sp(n))/(p−1)(n - s_p(n))/(p-1) of each exponent, where sp(n)s_p(n) is the digit sum of nn in base pp. Check: 20=10100220 = 10100_2 has digit sum 22, so the exponent of 22 is 20−2=1820 - 2 = 18.

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.