How come the number N! can terminate in exactly 1,2,3,4, or 6 zeroes but never 5 zeroes?
Answer
The number of zeros at the end of N! is given by ⌊N5⌋+⌊N52⌋+⌊N53⌋+⋯ where ⌊xy⌋ is the greatest integer ≤xy.
To make it clear, write N! as a product of primes N!=2α23α25α57α711α11… where αi∈N.
Note that α5<α2, ∀N. (Why?)
The number of zeros at the end of N! is the highest power of 10 dividing N!
If 10α divides N! and since 10=2×5, 2α|N! and 5α|N!. Further since α5<α2, the highest power of 10 dividing N! is the highest power of 5 dividing N! which is α5.
So you will find that for N≤24, the number of zeros will be less than or equal to 4. However when N hits 25 you will get 2 additional zeros courtesy 25 since 25×22=100. Hence, there will be a jump when you go from 24 to 25.
EDIT:
Note that there will be
A jump of 1 zero going from (N−1)! to N! if 5||N
A jump of 2 zero going from (N−1)! to N! if 52||N
A jump of 3 zero going from (N−1)! to N! if 53||N and in general
A jump of k zero going from (N−1)! to N! if 5k||N
where a||b means a divides b and gcd(a,ba) = 1
EDIT
Largest power of a prime dividing N!
In general, the highest power of a prime p dividing N! is given by
sp(N!)=⌊Np⌋+⌊Np2⌋+⌊Np3⌋+⋯
The first term appears since you want to count the number of terms less than N and are multiples of p and each of these contribute one p to N!. But then when you have multiples of p2 you are not multiplying just one p but you are multiplying two of these primes p to the product. So you now count the number of multiple of p2 less than N and add them. This is captured by the second term ⌊Np2⌋. Repeat this to account for higher powers of p less than N.
In case of the current example, the largest prime dividing 10 is 5. Hence, the largest power of 10 dividing N! is the same as the largest power of 5 dividing N!.
Largest power of a prime dividing other related products
In general, if we want to find the highest power of a prime p dividing numbers like 1×3×5×⋯(2N−1), P(N,r), \displaystyle \binom{N}{r}, the key is to write them in terms of factorials.
For instance, \displaystyle 1 \times 3 \times 5 \times \cdots (2N-1) = \frac{(2N)!}{2^N N!}. Hence, the largest power of a prime, p>2, dividing \displaystyle 1 \times 3 \times 5 \times \cdots (2N-1) is given by s_p((2N)!) - s_p(N!), where s_p(N!) is defined above. If p = 2, then the answer is s_p((2N)!) - s_p(N!) - N.
Similarly, \displaystyle P(N,r) = \frac{N!}{(N-r)!}. Hence, the largest power of a prime, dividing \displaystyle P(N,r) is given by s_p((N)!) - s_p((N-r)!), where s_p(N!) is defined above.
Similarly, \displaystyle C(N,r) = \binom{N}{r} = \frac{N!}{r!(N-r)!}. Hence, the largest power of a prime, dividing \displaystyle C(N,r) is given by s_p((N)!) - s_p(r!) - s_p((N-r)!), where s_p(N!) is defined above.
No comments:
Post a Comment