Daily

Random

Practice set

Baltic Way 1993 · Problem 8

Algebra

Compute the sum of all positive integers whose digits form either a strictly increasing or a strictly decreasing sequence.

Change pool

When you’re ready

Review material becomes available with the next Daily.

Review

Topics

Sequences and recurrences

Solutions

Solution

Solution:

Denote by II and DD the sets of all positive integers with strictly increasing (respectively, decreasing) sequence of digits. Let D0,D1,D2D_{0}, D_{1}, D_{2} and D3D_{3} be the subsets of DD consisting of all numbers starting with 99, not starting with 99, ending in 00 and not ending in 00, respectively. Let S(A)S(A) denote the sum of all numbers belonging to a set AA.

All numbers in II are obtained from the number 123456789123456789 by deleting some of its digits. Thus, for any k=0,1,…,9k=0,1, \ldots, 9 there are (9k)\binom{9}{k} kk-digit numbers in II (here we consider 00 a 00-digit number). Every kk-digit number a∈Ia \in I can be associated with a unique number b0∈D0b_{0} \in D_{0}, b1∈D1b_{1} \in D_{1} and b3∈D3b_{3} \in D_{3} such that

a+b0=999…9=10k+1−1a+b1=99…9=10k−1a+b3=111…10=109(10k−1)\begin{aligned} & a + b_{0} = 999\ldots 9 = 10^{k+1} - 1 \\ & a + b_{1} = 99\ldots 9 = 10^{k} - 1 \\ & a + b_{3} = 111\ldots 10 = \frac{10}{9}(10^{k} - 1) \end{aligned}

Hence we have

S(I)+S(D0)=∑k=09(9k)(10k+1−1)=10⋅119−29S(I)+S(D1)=∑k=09(9k)(10k−1)=119−29S(I)+S(D3)=109(119−29)\begin{aligned} & S(I) + S(D_{0}) = \sum_{k=0}^{9} \binom{9}{k} (10^{k+1} - 1) = 10 \cdot 11^{9} - 2^{9} \\ & S(I) + S(D_{1}) = \sum_{k=0}^{9} \binom{9}{k} (10^{k} - 1) = 11^{9} - 2^{9} \\ & S(I) + S(D_{3}) = \frac{10}{9}(11^{9} - 2^{9}) \end{aligned}

Noting that S(D0)+S(D1)=S(D2)+S(D3)=S(D)S(D_{0}) + S(D_{1}) = S(D_{2}) + S(D_{3}) = S(D) and S(D2)=10S(D3)S(D_{2}) = 10 S(D_{3}) we obtain the system of equations

{2S(I)+S(D)=1110−210S(I)+111S(D)=109(119−29)\left\{\begin{aligned} 2 S(I) + S(D) & = 11^{10} - 2^{10} \\ S(I) + \frac{1}{11} S(D) & = \frac{10}{9}(11^{9} - 2^{9}) \end{aligned}\right.

which yields

S(I)+S(D)=8081⋅1110−3581⋅210.S(I) + S(D) = \frac{80}{81} \cdot 11^{10} - \frac{35}{81} \cdot 2^{10}.

This sum contains all one-digit numbers twice, so the final answer is

8081⋅1110−3581⋅210−45=25617208995\frac{80}{81} \cdot 11^{10} - \frac{35}{81} \cdot 2^{10} - 45 = 25617208995

Contest context

Results from Baltic Way 1993

8 teams

Mean score
1.0 / 5
Scores of 4 or 5
0 / 8
Estonia
0 / 5

Score distribution

05
10
21
32
40
50
All team scores
TeamScore
Poland0 / 5
Latvia0 / 5
Estonia0 / 5
Sweden2 / 5
Lithuania3 / 5
Finland0 / 5
Iceland0 / 5
Denmark3 / 5