Maths Olympiad Prep

Library / /40 of 46

, 2022

Algebra Difficulty 7.1 National Olympiad, round 2 Prove it Japan

For each positive integer nn, define f(n)f(n) by
f(n)={n100(if digit sum of n is even),n100(if digit sum of n is odd). f(n) = \begin{cases} n^{100} & \text{(if digit sum of $n$ is even)}, \\ -n^{100} & \text{(if digit sum of $n$ is odd)}. \end{cases}
Let S=f(1)+f(2)++f(101001)S = f(1) + f(2) + \dots + f(10^{100} - 1), and determine the largest non-negative integer mm such that SS is divided by 5m5^m. (You can use the fact without proof that SS is nonzero.)

Solution

In the following, we denote d=100d = 100 and let f(0)=0f(0) = 0. Note that S=f(0)+f(1)++f(10d1)S = f(0) + f(1) + \dots + f(10^d - 1). For any integer nn such that 0n10d0 \le n \le 10^d, there exists unique (a0,a1,,ad1)(a_0, a_1, \dots, a_{d-1}) with 0ai90 \le a_i \le 9 (i=0,1,,d1i = 0, 1, \dots, d-1) such that
n=a0+a110++ad110d1. n = a_0 + a_1 \cdot 10 + \dots + a_{d-1} \cdot 10^{d-1}.
If n>0n > 0,
f(n)=(1)a0+a1++ad1(a0+a110++ad110d1)d() f(n) = (-1)^{a_0+a_1+\dots+a_{d-1}} (a_0 + a_1 \cdot 10 + \dots + a_{d-1} \cdot 10^{d-1})^d \quad (*)

(and it is obvious to check it also holds for n=0n = 0). Hence, SS equals to the sum of ()(*) for all (a0,a1,,ad1)(a_0, a_1, \dots, a_{d-1}) with 0ai90 \le a_i \le 9 (i=0,1,,d1i = 0, 1, \dots, d-1).
By multinomial theorem,
(a0+a110++ad110d1)d=db0++dd1=d,bi0d!b0!b1!bd1!bi0(ai10i)bi=db0++dd1=d,bi0d!b0!b1!bd1!(bi010ibi)(bi0aibi). (a_0 + a_1 \cdot 10 + \dots + a_{d-1} \cdot 10^{d-1})^d = \sum_d \sum_{b_0+\dots+d_{d-1}=d, b_i \ge 0} \frac{d!}{b_0!b_1!\dots b_{d-1}!} \prod_{b_i \ne 0} (a_i \cdot 10^i)^{b_i} \\ = \sum_d \sum_{b_0+\dots+d_{d-1}=d, b_i \ge 0} \frac{d!}{b_0!b_1!\dots b_{d-1}!} \left(\prod_{b_i \ne 0} 10^{ib_i}\right) \left(\prod_{b_i \ne 0} a_i^{b_i}\right).
Since d!b0!b1!bd1!bi010ibi\frac{d!}{b_0!b_1!\dots b_{d-1}!} \prod_{b_i \ne 0} 10^{ib_i} is independent of (a0,a1,,ad1)(a_0, a_1, \dots, a_{d-1}), it suffices to compute, for each (b0,b1,,bd1)(b_0, b_1, \dots, b_{d-1}),
a0=09ad1=09(1)a0+a1++ad1bi0aibi. \sum_{a_0=0}^{9} \dots \sum_{a_{d-1}=0}^{9} (-1)^{a_0+a_1+\dots+a_{d-1}} \prod_{b_i \ne 0} a_i^{b_i}.

In the case where bk0b_k \ne 0 for some 0kd10 \le k \le d-1, it equals zero since
ak=09((1)a0+a1++ak++ad1bi0aibi)=(ak=09(1)a0+a1++ak++ad1)bi0aibi=(15+(1)5)bi0aibi=0. \begin{aligned} \sum_{a_k=0}^{9} \left( (-1)^{a_0+a_1+\dots+a_k+\dots+a_{d-1}} \prod_{b_i \ne 0} a_i^{b_i} \right) &= \left( \sum_{a_k=0}^{9} (-1)^{a_0+a_1+\dots+a_k+\dots+a_{d-1}} \right) \prod_{b_i \ne 0} a_i^{b_i} \\ &= (1 \cdot 5 + (-1) \cdot 5) \prod_{b_i \ne 0} a_i^{b_i} \\ &= 0. \end{aligned}

In the case where bk0b_k \ne 0 for all kk, i.e. b0=b1==bd1=1b_0 = b_1 = \dots = b_{d-1} = 1,
(1)a0+a1++ad1bi0aibi=(1)a0+a1++ad1i=0d1ai=i=0d1((1)aiai). (-1)^{a_0+a_1+\dots+a_{d-1}} \prod_{b_i \ne 0} a_i^{b_i} = (-1)^{a_0+a_1+\dots+a_{d-1}} \prod_{i=0}^{d-1} a_i = \prod_{i=0}^{d-1} ((-1)^{a_i} \cdot a_i).

i=0d1(ai=09((1)aiai))=(5)d. \prod_{i=0}^{d-1} \left( \sum_{a_i=0}^{9} ((-1)^{a_i} \cdot a_i) \right) = (-5)^d.

b0=b1==bd1=1b_0 = b_1 = \dots = b_{d-1} = 1 implies
d!b0!b1!bd1!bi010ibi=d!i=0d110i=d!10d(d1)2, \frac{d!}{b_0!b_1!\dots b_{d-1}!} \prod_{b_i \ne 0} 10^{ib_i} = d! \prod_{i=0}^{d-1} 10^i = d! \cdot 10^{\frac{d(d-1)}{2}},
and hence
S=d!10d(d1)2(5)d=100!2495055050. S = d! \cdot 10^{\frac{d(d-1)}{2}} \cdot (-5)^d = 100! \cdot 2^{4950} \cdot 5^{5050}.
This concludes that the answer is 10051+10052+5050=5074\left\lfloor \frac{100}{5^1} \right\rfloor + \left\lfloor \frac{100}{5^2} \right\rfloor + 5050 = 5074.

Want a route through all this instead of an archive? The track puts 2,000 problems in a working order, from AMC 10 level to the IMO shortlist.

Source: MathNet, licensed CC-BY-4.0. Statement reproduced verbatim; metadata (topic, difficulty) added by this project.