Maths Olympiad Prep

Library / /63 of 94

Combinatorics Difficulty 6.5 National Olympiad Prove it Hong Kong

Let kk be a positive integer. Find the number of nonnegative integers nn less than or equal to 10k10^k satisfying the following conditions:
(i) nn is divisible by 33;
(ii) Each decimal digit of nn is one of the digits 22, 00, 11 or 77.

Solution

The answer is 4k13\frac{4^k - 1}{3} if 3k3 \nmid k, and 4k+23\frac{4^k + 2}{3} if 3k3 \mid k.

Note that nn has exactly kk digits, possibly starting with 00. We need to count the number NN of integers of the form a1a2ak\overline{a_1a_2\cdots a_k} such that each aja_j is one of 00, 11, 22, 77 and 3a1+a2++ak3 \mid a_1 + a_2 + \cdots + a_k. Consider the generating function

f(x)=(1+x+x2+x7)k=a1,,akaj{0,1,2,7}xa1+a2++ak. f(x) = (1 + x + x^2 + x^7)^k = \sum_{\substack{a_1, \dots, a_k \\ a_j \in \{0, 1, 2, 7\}}} x^{a_1 + a_2 + \cdots + a_k}.

Let cjc_j be the coefficient of xjx^j for each jj. Then N=3jcjN = \sum_{3 \mid j} c_j.

Let ω=12+32i\omega = \frac{-1}{2} + \frac{\sqrt{3}}{2}i be a cube root of unity. This means a number satisfying ω3=1\omega^3 = 1 and ω1\omega \neq 1. It has the property that ω2j+ωj+1=0\omega^{2j} + \omega^j + 1 = 0 if 3j3 \nmid j, and ω2j+ωj+1=3\omega^{2j} + \omega^j + 1 = 3 if 3j3 \mid j. It follows that

3N=jcj(1j+ωj+ω2j)=f(1)+f(ω)+f(ω2)=4k+(1+ω+ω2+ω7)k+(1+ω2+ω4+ω14)k=4k+ωk+ω2k. \begin{align*} 3N &= \sum_j c_j (1^j + \omega^j + \omega^{2j}) \\ &= f(1) + f(\omega) + f(\omega^2) \\ &= 4^k + (1 + \omega + \omega^2 + \omega^7)^k + (1 + \omega^2 + \omega^4 + \omega^{14})^k \\ &= 4^k + \omega^k + \omega^{2k}. \end{align*}

If 3k3 \nmid k, we have ωk+ω2k=1\omega^k + \omega^{2k} = -1. This gives N=4k13N = \frac{4^k - 1}{3}.

If 3k3 \mid k, we have ωk=ω2k=1\omega^k = \omega^{2k} = 1. This gives N=4k+23N = \frac{4^k + 2}{3}.

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.