Maths Olympiad Prep

Track / Stage 6 / 136 of 400 #1776 of 2604

Problem 1776

National Olympiad, first round
Combinatorics Difficulty 6.2 Prove it Vietnamese Mathematical Olympiad · 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\}.

This one wants a proof. Work it on paper, then read the official solution and mark yourself. Be honest about it: the record is only any use to you if it is.

Next problem →

Official solution

Denote by S={2,0,1,5}S = \{2, 0, 1, 5\} and
A(n,i)={xnxn−1…x1‾:xj∈S and x1+⋯+xn≡i(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 x1…xn+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+1−bn+1=an+2bn+cn−an−bn−2cn=bn−cn, a_{n+1} - b_{n+1} = a_n + 2b_n + c_n - a_n - b_n - 2c_n = b_n - c_n,
bn+1−cn+1=an+bn+2cn−2an−bn−cn=cn−an, b_{n+1} - c_{n+1} = a_n + b_n + 2c_n - 2a_n - b_n - c_n = c_n - a_n,
cn+1−an+1=cn+1−bn+1+bn+1−an+1=an−bn. 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+3−bn+3=bn+2−cn+2=cn+1−an+1=an−bn. a_{n+3} - b_{n+3} = b_{n+2} - c_{n+2} = c_{n+1} - a_{n+1} = a_n - b_n.
Similarly,
bn+3−cn+3=bn−cn,cn+3−an+3=cn−an. 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 k≡0(mod3)k \equiv 0 \pmod 3 then bk=ck=ak−1b_k = c_k = a_k - 1.
* If k≡1(mod3)k \equiv 1 \pmod 3 then ak=bk=ck−1a_k = b_k = c_k - 1.
* If k≡2(mod3)k \equiv 2 \pmod 3 then ak=ck=bk−1a_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)={akak−1…a1‾:aj∈S}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=4k−13a_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.

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