Maths Olympiad Prep

Library / Baltic Way Shortlist /81 of 92

Baltic Way Shortlist, 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, tata∈Mtata \in M, because it has length 44 and contains the letter tt twice, but mahatma∉Mmahatma \notin M, because it contains the letter tt only once.)

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

Solutions — 3

Solution 1

For k∈N0k \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=∣B∣b_{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=∣M∣m_{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=bk−1+9k(∗) b_k = b_{k-1} + 9^k \quad (*)
for all k≥1k \ge 1, since we can form exactly 9k9^k words of length kk from the given alphabet. The recursion
bk=1+9bk−1(∗∗) b_k = 1 + 9b_{k-1} \quad (**)
is also true for all k≥1k \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 k−1k-1 and one of the nine letters from the given alphabet (9bk−19b_{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 6⋅9=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+1−27mk+27mk−1+1 m_{k+2} = 9m_{k+1} - 27m_k + 27m_{k-1} + 1
is true for k≥1k \ge 1.

Proof of the lemma. We will consider two further sequences, first the sequence (pk)k∈N0(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)k∈N0(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 k≥1k \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 pk−1p_{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 3⋅mk−13 \cdot m_{k-1} cases).

We conclude that
mk=pk−1+3mk−1.(∗∗∗) m_k = p_{k-1} + 3m_{k-1}. \qquad (***)
In a similar spirit, we obtain
pk=qk−1+3pk−1(∗∗∗∗) p_k = q_{k-1} + 3p_{k-1} \qquad (****)
and
qk=1+3qk−1.(†) q_k = 1 + 3q_{k-1}. \qquad (†)
Equation (***) tells us that pk−1=mk−3mk−1p_{k-1} = m_k - 3m_{k-1}, from which we obtain pk=mk+1−3mkp_k = m_{k+1} - 3m_k by shifting indices. We plug both expressions into equation (****) and obtain
mk+1−3mk=qk−1+3(mk−3mk−1)(††)⇔qk−1=mk+1−6mk+9mk−1. \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,t∈Nr, s, t \in \mathbb{N} such that mk−1=bk−1+3k−1rm_{k-1} = b_{k-1} + 3^{k-1}r, mk−2=bk−2+3k−2sm_{k-2} = b_{k-2} + 3^{k-2}s and mk−3=bk−3+3k−3tm_{k-3} = b_{k-3} + 3^{k-3}t. It follows that
mk≡9bk−1−27bk−2+27bk−3+1(mod3k), m_k \equiv 9b_{k-1} - 27b_{k-2} + 27b_{k-3} + 1 \pmod{3^k},
from which we conclude
mk−bk≡−bk+9bk−1−27bk−2+27bk−3+1≡−bk+9bk−1−27(bk−1−9k−1)+27(bk−1−9k−1−9k−2)+1≡−bk+9bk−1+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 mk−bk≡0(mod3k)m_k - b_k \equiv 0 \pmod{3^k}, which finishes the induction step.

We now show that bk≡mk(mod3k)b_k \equiv m_k \pmod{3^k} for all k∈N≥0k \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 b0−m0=0−0=0b_0 - m_0 = 0 - 0 = 0 is divisible by 30=13^0 = 1. It is true for k=1k=1, because the difference b1−m1=10−10=0b_1 - m_1 = 10 - 10 = 0 is divisible by 31=33^1 = 3. It is true for k=2k=2, because the difference b2−m2=91−64=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+1−19−1=18(9k+1−1) |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 16∣B∣≡−2(mod3k)16|B| \equiv -2 \pmod{3^k}, since 2⋅9k+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+3−1x−1−x−1 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(x−1)2−1; 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+3−2(k+3)(k+1)xk+2+(k+3)(k+2)xk+1−2(x−1)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≡(3−1)3⋅f′′(3)=8⋅2∣M∣(mod3k)-2 \equiv (3-1)^3 \cdot f''(3) = 8 \cdot 2|M| \pmod{3^k}.
The congruence 16∣M∣≡−2≡16∣B∣(mod3k)16|M| \equiv -2 \equiv 16|B| \pmod{3^k} means that 16(∣B∣−∣M∣)16(|B| - |M|) is divisible by 3k3^k. Since 1616 is coprime to 3k3^k, the difference ∣B∣−∣M∣|B| - |M| is also divisible by 3k=320233^k = 3^{2023}.

Solution 3

We consider the 3-adic expansion of x:=−12=11−3=∑k=0∞3kx := -\frac{1}{2} = \frac{1}{1-3} = \sum_{k=0}^{\infty} 3^k and y:=−18=11−9=∑ℓ=0∞32ℓy := -\frac{1}{8} = \frac{1}{1-9} = \sum_{\ell=0}^{\infty} 3^{2\ell}. Observe that y=x3y = x^3 and, therefore,
∑ℓ=0∞32ℓ=(∑k=0∞1⋅3k)3=∑k=0∞ak⋅3k, \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
∑ℓ=0∞32ℓ=∑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
∣B∣≡∣M∣(mod32023). |B| \equiv |M| \pmod{3^{2023}}.

Want a route through all this instead of an archive? The track puts 2,604 problems in a working order, from Junior Challenge level to the IMO shortlist.

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