Maths Olympiad Prep

Library / /31 of 36

, 2023

Combinatorics Difficulty 8.8 Shortlist Prove it Baltic Way

Let kk be a non-negative integer and let AA be a nonempty finite set. We define a word from the alphabet AA of length kk as a sequence of elements of AA of length kk. (Notice that by definition the empty sequence is a word of length 00.)

* Let BB be the set of all words from the nine-element alphabet {b,@,l,t,i,c,w,a,y}\{b, @, l, t, i, c, w, a, y\}, whose lengths are at most 20232023.
* Moreover, let MM be the set of all words from the four-element alphabet {m,a,t,h}\{m, a, t, h\}, whose lengths are at most 20252025 and which contain the element tt exactly twice.
(For example, tataMtata \in M, because it has length 44 and contains the letter tt twice, but mahatmaMmahatma \notin M, because it contains the letter tt only once.)

Prove that the difference BM|B| - |M| is divisible by 320233^{2023}.

Solutions — 3

Solution 1

For kN0k \in \mathbb{N}_0 we denote by bkb_k the number of words from the alphabet {b,@,l,t,i,c,w,a,y}\{b, @, l, t, i, c, w, a, y\} of maximum length kk, so that b2023=Bb_{2023} = |B|. Furthermore, we denote by mkm_k the number of words of maximum length k+2k+2 from the alphabet {m,a,t,h}\{m, a, t, h\}, that contain the letter tt exactly twice, so that m2023=Mm_{2023} = |M|.
For example, we have b0=1b_0 = 1 (coming from the empty word), b1=b0+9=10b_1 = b_0 + 9 = 10 (adding 99 one-letter words) and b2=b1+92=91b_2 = b_1 + 9^2 = 91 (adding 929^2 two-letter words). More generally, we have
bk=bk1+9k() b_k = b_{k-1} + 9^k \quad (*)
for all k1k \ge 1, since we can form exactly 9k9^k words of length kk from the given alphabet. The recursion
bk=1+9bk1() b_k = 1 + 9b_{k-1} \quad (**)
is also true for all k1k \ge 1, since every word of maximum length kk from the given alphabet is either the empty word (1 case) or the concatenation of a word of maximum length k1k-1 and one of the nine letters from the given alphabet (9bk19b_{k-1} cases).

On the other hand, we have m0=1m_0 = 1 (coming from the word tttt), m1=m0+9=10m_1 = m_0 + 9 = 10 (adding 99 words of the form txtx, txttxt and xttxtt with x{h,a,m}x \in \{h, a, m\}) and m2=m1+54=64m_2 = m_1 + 54 = 64 (adding 69=546 \cdot 9 = 54 words of the form ttxyttxy, txtytxty, txyttxyt, xttyxtty, xtytxtyt and xyttxytt with x,y{h,a,m}x, y \in \{h, a, m\}).

Lemma. The recursion
mk+2=9mk+127mk+27mk1+1 m_{k+2} = 9m_{k+1} - 27m_k + 27m_{k-1} + 1
is true for k1k \ge 1.

*Proof of the lemma.* We will consider two further sequences, first the sequence (pk)kN0(p_k)_{k \in \mathbb{N}_0}, where pkp_k is the number of words of maximum length k+2k+2 from the alphabet {m,a,t,h}\{m, a, t, h\}, that contain the letter tt exactly once. We will also consider the sequence (qk)kN0(q_k)_{k \in \mathbb{N}_0}, where qkq_k is the number of words of maximum length k+2k+2 from the alphabet {m,a,t,h}\{m, a, t, h\}, that do not use the letter tt at all (i.e. words of maximum length k+2k+2 from the alphabet {h,a,m}\{h, a, m\}).

Let k1k \ge 1 for the moment. A word of maximum length k+2k+2 from the alphabet {m,a,t,h}\{m, a, t, h\}, that contains the letter tt exactly twice, is either
* the concatenation of the letter tt with a word of maximum length k+1k+1 with exactly one occurrence of the letter tt (of which there are pk1p_{k-1} cases) or
* the concatenation of a letter x{h,a,m}x \in \{h, a, m\} with a word of maximum length k+1k+1 with exactly two occurrences of the letter tt (of which there are 3mk13 \cdot m_{k-1} cases).

We conclude that
mk=pk1+3mk1.() m_k = p_{k-1} + 3m_{k-1}. \qquad (***)
In a similar spirit, we obtain
pk=qk1+3pk1() p_k = q_{k-1} + 3p_{k-1} \qquad (****)
and
qk=1+3qk1.() q_k = 1 + 3q_{k-1}. \qquad (†)
Equation (***) tells us that pk1=mk3mk1p_{k-1} = m_k - 3m_{k-1}, from which we obtain pk=mk+13mkp_k = m_{k+1} - 3m_k by shifting indices. We plug both expressions into equation (****) and obtain
mk+13mk=qk1+3(mk3mk1)(††)qk1=mk+16mk+9mk1. \begin{align*} m_{k+1} - 3m_k &= q_{k-1} + 3(m_k - 3m_{k-1}) && (††) \\ \Leftrightarrow q_{k-1} &= m_{k+1} - 6m_k + 9m_{k-1}. \end{align*}
Plugging equation (††) and its index shift into equation (†) yields the recursion from the lemma. \square

Thanks to the lemma. By induction hypothesis, there exist natural numbers r,s,tNr, s, t \in \mathbb{N} such that mk1=bk1+3k1rm_{k-1} = b_{k-1} + 3^{k-1}r, mk2=bk2+3k2sm_{k-2} = b_{k-2} + 3^{k-2}s and mk3=bk3+3k3tm_{k-3} = b_{k-3} + 3^{k-3}t. It follows that
mk9bk127bk2+27bk3+1(mod3k), m_k \equiv 9b_{k-1} - 27b_{k-2} + 27b_{k-3} + 1 \pmod{3^k},
from which we conclude
mkbkbk+9bk127bk2+27bk3+1bk+9bk127(bk19k1)+27(bk19k19k2)+1bk+9bk1+1(mod3k). \begin{align*} m_k - b_k &\equiv -b_k + 9b_{k-1} - 27b_{k-2} + 27b_{k-3} + 1 \\ &\equiv -b_k + 9b_{k-1} - 27(b_{k-1} - 9^{k-1}) + 27(b_{k-1} - 9^{k-1} - 9^{k-2}) + 1 \\ &\equiv -b_k + 9b_{k-1} + 1 \pmod{3^k}. \end{align*}
thanks to equation (*). By equation (**) we have mkbk0(mod3k)m_k - b_k \equiv 0 \pmod{3^k}, which finishes the induction step.

We now show that bkmk(mod3k)b_k \equiv m_k \pmod{3^k} for all kN0k \in \mathbb{N}_{\ge 0}, which yields the desired statement when we put k=2023k = 2023.
We are going to show our claim by strong mathematical induction on kk. The claim is true for k=0k=0, because the difference b0m0=00=0b_0 - m_0 = 0 - 0 = 0 is divisible by 30=13^0 = 1. It is true for k=1k=1, because the difference b1m1=1010=0b_1 - m_1 = 10 - 10 = 0 is divisible by 31=33^1 = 3. It is true for k=2k=2, because the difference b2m2=9164=27b_2 - m_2 = 91 - 64 = 27 is divisible by 32=93^2 = 9.

Solution 2

Let k=2023k = 2023. Since there are exactly 9i9^i words of length ii in the set BB for every i[0,k]i \in [0, k], we have
B=i=0k9i=9k+1191=18(9k+11) |B| = \sum_{i=0}^{k} 9^i = \frac{9^{k+1} - 1}{9 - 1} = \frac{1}{8} (9^{k+1} - 1)
thanks to the formula for the geometric series. In particular, multiplication by 1616 brings us to the congruence 16B2(mod3k)16|B| \equiv -2 \pmod{3^k}, since 29k+12 \cdot 9^{k+1} is divisible by 3k3^k.

Moreover, every word in MM is bounded by length by k+2k+2. If ii parametrises the number of occurrences of letters different from tt in a word in MM, then the word's length is i+2i+2 and there are (i+22)\binom{i+2}{2} possibilities to choose two places for the two letters tt. The other ii letters can be arbitrary elements from the set {h,a,m}\{h, a, m\}. It follows that
M=i=0k(i+22)3i. |M| = \sum_{i=0}^{k} \binom{i+2}{2} 3^i.
Define a function f:R{1}Rf:\mathbb{R} \setminus \{1\} \to \mathbb{R} by
f(x)=i=0kxi+2=xk+31x1x1 f(x) = \sum_{i=0}^{k} x^{i+2} = \frac{x^{k+3} - 1}{x - 1} - x - 1
for all xx. Its first derivative is given by
f(x)=i=0k(i+2)xi+1=(k+2)xk+3(k+3)xk+2+1(x1)21; f'(x) = \sum_{i=0}^{k} (i+2)x^{i+1} = \frac{(k+2)x^{k+3} - (k+3)x^{k+2} + 1}{(x-1)^2} - 1;
its second derivative f(x)=i=0k(i+2)(i+1)xif''(x) = \sum_{i=0}^{k} (i+2)(i+1)x^i is given by
(k+2)(k+1)xk+32(k+3)(k+1)xk+2+(k+3)(k+2)xk+12(x1)3. \frac{(k+2)(k+1)x^{k+3} - 2(k+3)(k+1)x^{k+2} + (k+3)(k+2)x^{k+1} - 2}{(x-1)^3}.
If we plug in x=3x = 3 in the last equation, every summand in the numerator of the previous fraction is divisible by 3k3^k except for 2-2. It follows that 2(31)3f(3)=82M(mod3k)-2 \equiv (3-1)^3 \cdot f''(3) = 8 \cdot 2|M| \pmod{3^k}.
The congruence 16M216B(mod3k)16|M| \equiv -2 \equiv 16|B| \pmod{3^k} means that 16(BM)16(|B| - |M|) is divisible by 3k3^k. Since 1616 is coprime to 3k3^k, the difference BM|B| - |M| is also divisible by 3k=320233^k = 3^{2023}.

Solution 3

We consider the 3-adic expansion of x:=12=113=k=03kx := -\frac{1}{2} = \frac{1}{1-3} = \sum_{k=0}^{\infty} 3^k and y:=18=119==032y := -\frac{1}{8} = \frac{1}{1-9} = \sum_{\ell=0}^{\infty} 3^{2\ell}. Observe that y=x3y = x^3 and, therefore,
=032=(k=013k)3=k=0ak3k, \sum_{\ell=0}^{\infty} 3^{2\ell} = \left( \sum_{k=0}^{\infty} 1 \cdot 3^k \right)^3 = \sum_{k=0}^{\infty} a_k \cdot 3^k,
where aka_k is the number of presentations of kk as an ordered sum of three summands. Since we can place between kk objects two “plus” symbols in (k+22)\binom{k+2}{2} ways and interpret the number of objects before the first plus as the first summand, between the two pluses as the second and after the second plus sign as the third summand, we have ak=(k+22)a_k = \binom{k+2}{2}. Hence, we get
=032=k=0(k+22)3k. \sum_{\ell=0}^{\infty} 3^{2\ell} = \sum_{k=0}^{\infty} \binom{k+2}{2} \cdot 3^k.
Reducing this 3-adic identity modulo 320233^{2023} gives
BM(mod32023). |B| \equiv |M| \pmod{3^{2023}}.

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.