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

Exercise 1.2.5-14

stated in Lean solution written

RatingM28
MarkersM (mathematical), recommended
KindK1, prove: show that a stated fact is true from the written solution
SectionSection 1.2.5 of Volume 1. Companion chapter: Permutations and factorials

The task

Prove Stickelberger's congruence: with μ\mu the exponent of pp in n!n! and ak…a0a_k \ldots a_0 the base-pp digits of nn, n!/pμ≡(−1)μa0! a1!⋯ak!(modp)n!/p^\mu \equiv (-1)^\mu a_0!\,a_1!\cdots a_k! \pmod p.

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

Split the product 1⋅2⋯n1 \cdot 2 \cdots n into the multiples of pp and the other numbers. Wilson's theorem, exercise 13, handles full blocks of p−1p-1 numbers.

Hint 2

Write n=pm+a0n = pm + a_0. The multiples of pp give pm m!p^m\, m!. The others give (−1)ma0!(-1)^m a_0! modulo pp. Then use induction on the number of digits of nn.

Hint 3

The exponent satisfies μ(n)=m+μ(m)\mu(n) = m + \mu(m) for m=⌊n/p⌋m = \lfloor n/p \rfloor, by eq. (8).

Solution

Show the solution

Plan. Cut one digit off nn at a time. Show that n!/pμn!/p^{\mu} equals m!/pμ(m)m!/p^{\mu(m)} times a product of numbers prime to pp, and that this product is (−1)ma0!(-1)^m a_0! modulo pp. Induction on the number of digits then gives the digit product.

Setup. Let n=pm+a0n = pm + a_0 with m=⌊n/p⌋m = \lfloor n/p \rfloor and 0≤a0<p0 \le a_0 < p. The digits of mm are ak,…,a1a_k, \ldots, a_1. Let μ(n)\mu(n) be the exponent of pp in n!n!. Eq. (8) gives μ(n)=m+∑j≥1⌊m/pj⌋=m+μ(m)\mu(n) = m + \sum_{j \ge 1} \lfloor m/p^j \rfloor = m + \mu(m), because ⌊n/pj+1⌋=⌊m/pj⌋\lfloor n/p^{j+1} \rfloor = \lfloor m/p^j \rfloor.

Splitting the product. The multiples of pp among 1,…,n1, \ldots, n are p,2p,…,mpp, 2p, \ldots, mp. Their product is pm m!p^m\, m!. Let NN be the product of the other numbers up to nn. Then n!=pm m! Nn! = p^m\, m!\, N.

The value of NN modulo pp. The numbers prime to pp up to nn fall into mm full blocks {tp+1,…,tp+p−1}\{tp+1, \ldots, tp + p - 1\} for t=0,…,m−1t = 0, \ldots, m-1, and one partial block {mp+1,…,mp+a0}\{mp+1, \ldots, mp + a_0\}. A full block is congruent to {1,…,p−1}\{1, \ldots, p-1\} term by term, so its product is ≡(p−1)!≡−1\equiv (p-1)! \equiv -1 by exercise 13. The partial block has product ≡1⋅2⋯a0=a0!\equiv 1 \cdot 2 \cdots a_0 = a_0!. So

N≡(−1)m a0!(modp).N \equiv (-1)^m\, a_0! \pmod p.

Induction on the number of digits. If n<pn < p then m=0m = 0, μ=0\mu = 0 and n!=a0!n! = a_0!, so the claim holds. Let the claim hold for mm, which has one digit less than nn:

m!pμ(m)≡(−1)μ(m) a1!⋯ak!(modp).\frac{m!}{p^{\mu(m)}} \equiv (-1)^{\mu(m)}\, a_1! \cdots a_k! \pmod p.

Then

n!pμ(n)=pm m! Npm+μ(m)=m!pμ(m)⋅N≡(−1)μ(m) a1!⋯ak!⋅(−1)m a0!=(−1)μ(n) a0! a1!⋯ak!.\frac{n!}{p^{\mu(n)}} = \frac{p^m\, m!\, N}{p^{m + \mu(m)}} = \frac{m!}{p^{\mu(m)}} \cdot N \equiv (-1)^{\mu(m)}\, a_1!\cdots a_k! \cdot (-1)^m\, a_0! = (-1)^{\mu(n)}\, a_0!\, a_1! \cdots a_k!.

The last step uses μ(n)=m+μ(m)\mu(n) = m + \mu(m).

Check

Take p=5p = 5 and n=12=225n = 12 = 22_5, so a0=a1=2a_0 = a_1 = 2. By eq. (8), μ=2\mu = 2. Then 12!/52=479001600/25=1916006412!/5^2 = 479001600/25 = 19160064, and 19160064 mod 5=419160064 \bmod 5 = 4. The right side is (−1)2 2! 2!=4(-1)^2\, 2!\,2! = 4. Another case: p=3p = 3, n=7=213n = 7 = 21_3, μ=2\mu = 2, 7!/9=560≡2(mod3)7!/9 = 560 \equiv 2 \pmod 3, and (−1)2 1! 2!=2(-1)^2\, 1!\, 2! = 2. Python checks all n<400n < 400 for p∈{2,3,5,7,11}p \in \{2, 3, 5, 7, 11\}.

Remarks

For n=pn = p the congruence says (p−1)!≡−1(p-1)! \equiv -1, which is exercise 13. The result gives a way to compute n! mod pn! \bmod p, after removing the factors pp, from the small factorials ai!a_i! alone.

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

In Lean

stated The statement is in Lean and it builds. The proof is not in Lean yet.

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

Something is wrong? Report it.