Maths Olympiad Prep

Library / /19 of 53

Combinatorics Difficulty 6.2 National olympiad Prove it Vietnam

Given a positive integer kk. Find the number of non-negative integers that do not exceed 10k10^k and satisfy the following conditions

i) nn is divisible by 33,
ii) The digits of nn in decimal representation are in the set {2,0,1,5}\{2, 0, 1, 5\}.

Solution

Denote by S={2,0,1,5}S = \{2, 0, 1, 5\} and
A(n,i)={xnxn1x1:xjS and x1++xni(mod3)}. A(n, i) = \{\overline{x_n x_{n-1} \dots x_1} : x_j \in S \text{ and } x_1 + \dots + x_n \equiv i \pmod{3}\}.
Let an,bna_n, b_n and cnc_n be the cardinal number of A(n,0)A(n, 0), A(n,1)A(n, 1) and A(n,2)A(n, 2) respectively. Since a natural number is divisible by 33 if and only if the sum of its digits is a multiple of 33, we only need to count the number of elements in the set A(k,0)A(k, 0). Let x1xn+1\overline{x_1 \dots x_{n+1}} be an element of A(n+1,0)A(n+1, 0), we have

* If xn+1=0x_{n+1} = 0 then (x1,x2,,xn)A(n,0)(x_1, x_2, \dots, x_n) \in A(n, 0).
* If xn+1=2x_{n+1} = 2 or 55 then (x1,x2,,xn)A(n,1)(x_1, x_2, \dots, x_n) \in A(n, 1).
* If xn+1=1x_{n+1} = 1 then (x1,x2,,xn)A(n,2)(x_1, x_2, \dots, x_n) \in A(n, 2).

Hence, an+1=an+2bn+cna_{n+1} = a_n + 2b_n + c_n (1). Similarly, we get
bn+1=an+bn+2cn,(2) b_{n+1} = a_n + b_n + 2c_n, \quad (2)
cn+1=2an+bn+cn.(3) c_{n+1} = 2a_n + b_n + c_n. \qquad (3)
From those equations, we have a2=5a_2 = 5, b2=6b_2 = 6, c2=5c_2 = 5, a3=22a_3 = 22, b3=21b_3 = 21, c3=21c_3 = 21. Moreover,
an+1bn+1=an+2bn+cnanbn2cn=bncn, a_{n+1} - b_{n+1} = a_n + 2b_n + c_n - a_n - b_n - 2c_n = b_n - c_n,
bn+1cn+1=an+bn+2cn2anbncn=cnan, b_{n+1} - c_{n+1} = a_n + b_n + 2c_n - 2a_n - b_n - c_n = c_n - a_n,
cn+1an+1=cn+1bn+1+bn+1an+1=anbn. c_{n+1} - a_{n+1} = c_{n+1} - b_{n+1} + b_{n+1} - a_{n+1} = a_n - b_n.
This leads to
an+3bn+3=bn+2cn+2=cn+1an+1=anbn. a_{n+3} - b_{n+3} = b_{n+2} - c_{n+2} = c_{n+1} - a_{n+1} = a_n - b_n.
Similarly,
bn+3cn+3=bncn,cn+3an+3=cnan. b_{n+3} - c_{n+3} = b_n - c_n, \quad c_{n+3} - a_{n+3} = c_n - a_n.
Hence, it is easy to see that
* If k0(mod3)k \equiv 0 \pmod 3 then bk=ck=ak1b_k = c_k = a_k - 1.
* If k1(mod3)k \equiv 1 \pmod 3 then ak=bk=ck1a_k = b_k = c_k - 1.
* If k2(mod3)k \equiv 2 \pmod 3 then ak=ck=bk1a_k = c_k = b_k - 1.

On the other hand, ak+bk+cka_k + b_k + c_k is equal to the cardinal number of A(k)={akak1a1:ajS}A(k) = \{\overline{a_k a_{k-1} \dots a_1} : a_j \in S\} so that
ak+bk+ck=4k. a_k + b_k + c_k = 4^k.
In conclusion, the value of aka_k is
* ak=4k13a_k = \frac{4^k - 1}{3} if kk is not a multiple of 33;
* ak=4k+23a_k = \frac{4^k + 2}{3} if kk is a multiple of 33.

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 and solution reproduced as published; topic and difficulty added by this site.