IMO 1991 SL 15

Let an be the last nonzero digit in the decimal representation

IMO 1991 SL 15

Origin: USS

Problem

Let an be the last nonzero digit in the decimal representation of the number n!. Does the sequence a1, a2, . . . , an, . . . become periodic after a finite number of terms?

Solution

Assume that the sequence has the period T . We can find integers k > m > 0, as large as we like, such that 10k \equiv10m (mod T ), using for example Euler’s theorem. It is obvious that a10k−1 = a10k and hence, taking k sufficiently large and using the periodicity, we see that a2\cdot10k−10m−1 = a10k−1 = a10k = a2\cdot10k−10m. Since (2 \cdot 10k −10m)! = (2 \cdot 10k −10m)(2 \cdot 10k −10m −1)! and the last nonzero digit of 2 \cdot 10k −10m is nine, we must have a2\cdot10k−10m−1 = 5 (if s is a digit, the last digit of 9s is s only if s = 5). But this means that 5 divides n! with a greater power than 2 does, which is impossible. Indeed, if the exponents of these powers are \alpha2, \alpha5 respectively, then \alpha5 = [n/5] + [n/52] + \cdot \cdot \cdot \leq\alpha2 = [n/2] + [n/22] + \cdot \cdot \cdot .