Maths Olympiad Prep

Library / IMO Shortlist /347 of 365

IMO Shortlist, 2007

Combinatorics Difficulty 9.1 IMO level Prove it IMO

Let n>1n > 1 be an integer. Find all sequences a1,a2,…,an2+na_{1}, a_{2}, \ldots, a_{n^{2}+n} satisfying the following conditions:
(a) ai∈{0,1}a_{i} \in \{0,1\} for all 1≤i≤n2+n1 \leq i \leq n^{2}+n;
(b) ai+1+ai+2+…+ai+n<ai+n+1+ai+n+2+…+ai+2na_{i+1}+a_{i+2}+\ldots+a_{i+n} < a_{i+n+1}+a_{i+n+2}+\ldots+a_{i+2n} for all 0≤i≤n2−n0 \leq i \leq n^{2}-n.

Solutions — 2

Solution 1

Consider a sequence (aia_{i}) satisfying the conditions. For arbitrary integers 0≤k≤l≤n2+n0 \leq k \leq l \leq n^{2}+n denote S(k,l]=ak+1+⋯+alS(k, l] = a_{k+1} + \cdots + a_{l}. (If k=lk = l then S(k,l]=0S(k, l] = 0.) Then condition (b) can be rewritten as S(i,i+n]<S(i+n,i+2n]S(i, i+n] < S(i+n, i+2n] for all 0≤i≤n2−n0 \leq i \leq n^{2}-n. Notice that for 0≤k≤l≤m≤n2+n0 \leq k \leq l \leq m \leq n^{2}+n we have S(k,m]=S(k,l]+S(l,m]S(k, m] = S(k, l] + S(l, m].

By condition (b),
0≤S(0,n]<S(n,2n]<⋯<S(n2,n2+n]≤n. 0 \leq S(0, n] < S(n, 2n] < \cdots < S\left(n^{2}, n^{2}+n\right] \leq n.
We have only n+1n+1 distinct integers in the interval [0,n][0, n]; hence,
S(vn,(v+1)n]=vfor all 0≤v≤n.(2) S(vn, (v+1)n] = v \quad \text{for all } 0 \leq v \leq n. \tag{2}
In particular, S(0,n]=0S(0, n] = 0 and S(n2,n2+n]=nS\left(n^{2}, n^{2}+n\right] = n, therefore
a1=a2=…=an=0an2+1=an2+2=…=an2+n=1 \begin{align*} a_{1} & = a_{2} = \ldots = a_{n} = 0 \tag{3}\\ a_{n^{2}+1} & = a_{n^{2}+2} = \ldots = a_{n^{2}+n} = 1 \tag{4} \end{align*}
Subdivide sequence (aia_{i}) into n+1n+1 blocks, each consisting of nn consecutive terms, and number them from 0 to nn. We show by induction on vv that the vvth block has the form
(0…0⏟n−v1…1⏟v) (\underbrace{0 \ldots 0}_{n-v} \underbrace{1 \ldots 1}_{v})
The base case v=0v=0 is provided by (3).

Consider the vvth block for v>0v>0. By (2), it contains some "ones". Let the first "one" in this block be at the uuth position (that is, au+vn=1a_{u+vn} = 1). By the induction hypothesis, the (v−1)(v-1)th and vvth blocks of (ai)\left(a_{i}\right) have the form
(0…0⏟n−v+1)(0…0⏟1∗…∗) (\underbrace{0 \ldots 0}_{n-v+1})(\underbrace{0 \ldots 0} 1 * \ldots *)
where each star can appear to be any binary digit. Observe that u≤n−v+1u \leq n-v+1, since the sum in this block is vv. Then, the fragment of length nn bracketed above has exactly (v−1)+1(v-1)+1 ones, i.e. S(u+(v−1)n,u+vn]=vS(u+(v-1)n, u+vn] = v. Hence,
v=S(u+(v−1)n,u+vn]<S(u+vn,u+(v+1)n]<⋯<S(u+(n−1)n,u+n2]≤n; v = S(u+(v-1)n, u+vn] < S(u+vn, u+(v+1)n] < \cdots < S\left(u+(n-1)n, u+n^{2}\right] \leq n;
we have n−v+1n-v+1 distinct integers in the interval [v,n][v, n], therefore S(u+(t−1)n,u+tn]=tS(u+(t-1)n, u+tn] = t for each t=v,…,nt = v, \ldots, n.

Thus, the end of sequence (ai)\left(a_{i}\right) looks as following:
(u zeroes⏟v−10…01…1⏞0…0)(0…01⏟v0…∗⏞v+1(∗…∗∗…∗⏟v+1)…(1…1⏟n1…1⏞n) (\underbrace{u \text{ zeroes}}_{v-1} \overbrace{0 \ldots 01 \ldots 1}^{0 \ldots 0})(\underbrace{0 \ldots 01}_{v} \overbrace{0 \ldots *}^{v+1}(\underbrace{* \ldots * * \ldots *}_{v+1}) \ldots (\underbrace{1 \ldots 1}_{n} \overbrace{1 \ldots 1}^{n})
(each bracketed fragment contains nn terms). Computing in two ways the sum of all digits above, we obtain n−u=v−1n-u = v-1 and u=n−v+1u = n-v+1. Then, the first n−vn-v terms in the vvth block are zeroes, and the next vv terms are ones, due to the sum of all terms in this block. The statement is proved.

We are left to check that the sequence obtained satisfies the condition. Notice that ai≤ai+na_{i} \leq a_{i+n} for all 1≤i≤n21 \leq i \leq n^{2}. Moreover, if 1≤u≤n1 \leq u \leq n and 0≤v≤n−10 \leq v \leq n-1, then au+vn<au+vn+na_{u+vn} < a_{u+vn+n} exactly when u+v=nu+v = n. In this case we have u+vn=n+v(n−1)u+vn = n+v(n-1).

Consider now an arbitrary index 0≤i≤n2−n0 \leq i \leq n^{2}-n. Clearly, there exists an integer vv such that n+v(n−1)∈[i+1,i+n]n+v(n-1) \in [i+1, i+n]. Then, applying the above inequalities we obtain that condition (b) is valid.

Solution 2

Similarly to Solution 1, we introduce the notation S(k,l]S(k, l] and obtain (2), (3), and (4) in the same way. The sum of all elements of the sequence can be computed as
S(0,n2+n]=S(0,n]+S(n,2n]+…+S(n2,n2+n]=0+1+…+n. S\left(0, n^{2}+n\right] = S(0, n] + S(n, 2n] + \ldots + S\left(n^{2}, n^{2}+n\right] = 0 + 1 + \ldots + n.
For an arbitrary integer 0≤u≤n0 \leq u \leq n, consider the numbers
S(u,u+n]<S(u+n,u+2n]<…<S(u+(n−1)n,u+n2].(5) S(u, u+n] < S(u+n, u+2n] < \ldots < S\left(u+(n-1)n, u+n^{2}\right]. \tag{5}
They are nn distinct integers from the n+1n+1 possible values 0,1,2,…,n0, 1, 2, \ldots, n. Denote by mm the "missing" value which is not listed. We determine mm from S(0,n2+n]S\left(0, n^{2}+n\right]. Write this sum as
S(0,n2+n]=S(0,u]+S(u,u+n]+S(u+n,u+2n]+…+S(u+(n−1)n,u+n2]+S(u+n2,n2+n]S\left(0, n^{2}+n\right] = S(0, u] + S(u, u+n] + S(u+n, u+2n] + \ldots + S\left(u+(n-1)n, u+n^{2}\right] + S\left(u+n^{2}, n^{2}+n\right].
Since a1=a2=…=au=0a_{1} = a_{2} = \ldots = a_{u} = 0 and au+n2+1=…=an2+n=1a_{u+n^{2}+1} = \ldots = a_{n^{2}+n} = 1, we have S(0,u]=0S(0, u] = 0 and S(u+n2,n+n2]=n−uS\left(u+n^{2}, n+n^{2}\right] = n-u. Then
0+1+…+n=S(0,n2+n]=0+((0+1+…+n)−m)+(n−u), 0+1+\ldots+n = S\left(0, n^{2}+n\right] = 0 + ((0+1+\ldots+n) - m) + (n-u),
so m=n−um = n-u.

Hence, the numbers listed in (5) are 0,1,…,n−u−10, 1, \ldots, n-u-1 and n−u+1,…,nn-u+1, \ldots, n, respectively, therefore
S(u+vn,u+(v+1)n]={v,v≤n−u−1,v+1,v≥n−ufor all 0≤u≤n,0≤v≤n−1.(6) S(u+vn, u+(v+1)n] = \left\{\begin{array}{ll} v, & v \leq n-u-1, \tag{6}\\ v+1, & v \geq n-u \end{array} \quad \text{for all } 0 \leq u \leq n, 0 \leq v \leq n-1.\right.
Conditions (6), together with (3), provide a system of linear equations in variables aia_{i}. Now we solve this system and show that the solution is unique and satisfies conditions (a) and (b).

First, observe that any solution of the system (3), (6) satisfies the condition (b). By the construction, equations (6) immediately imply (5). On the other hand, all inequalities mentioned in condition (b) are included into the chain (5) for some value of uu.

Next, note that the system (3), (6) is redundant. The numbers S(kn,(k+1)n]S(kn, (k+1)n], where 1≤k≤n−11 \leq k \leq n-1, appear twice in (6). For u=0u=0 and v=kv=k we have v≤n−u−1v \leq n-u-1, and (6) gives S(kn,(k+1)n]=v=kS(kn, (k+1)n] = v = k. For u=nu=n and v=k−1v=k-1 we have v≥n−uv \geq n-u and we obtain the same value, S(kn,(k+1)n]=v+1=kS(kn, (k+1)n] = v+1 = k. Therefore, deleting one equation from each redundant pair, we can make every sum S(k,k+n]S(k, k+n] appear exactly once on the left-hand side in (6).

Now, from (3), (6), the sequence (ai)\left(a_{i}\right) can be reconstructed inductively by
a1=a2=…=an−1=0,ak+n=S(k,k+n]−(ak+1+ak+2+…+ak+n−1)(0≤k≤n2) a_{1} = a_{2} = \ldots = a_{n-1} = 0, \quad a_{k+n} = S(k, k+n] - \left(a_{k+1} + a_{k+2} + \ldots + a_{k+n-1}\right) \quad (0 \leq k \leq n^{2})
taking the values of S(k,k+n]S(k, k+n] from (6). This means first that there exists at most one solution of our system. Conversely, the constructed sequence obviously satisfies all equations (3), (6) (the only missing equation is an=0a_{n} = 0, which follows from S(0,n]=0S(0, n] = 0). Hence it satisfies condition (b), and we are left to check condition (a) only.

For arbitrary integers 1≤u,t≤n1 \leq u, t \leq n we get
au+tn−au+(t−1)n=S(u+(t−1)n,u+tn]−S((u−1)+(t−1)n,(u−1)+tn]={(t−1)−(t−1)=0,t≤n−ut−(t−1)=1,t=n−u+1t−t=0,t≥n−u+2 \begin{aligned} a_{u+tn} - a_{u+(t-1)n} & = S(u+(t-1)n, u+tn] - S((u-1)+(t-1)n, (u-1)+tn] \\ & = \begin{cases} (t-1)-(t-1) = 0, & t \leq n-u \\ t-(t-1) = 1, & t = n-u+1 \\ t-t = 0, & t \geq n-u+2 \end{cases} \end{aligned}
Since au=0a_{u} = 0, we have
au+vn=au+vn−au=∑t=1v(au+tn−au+(t−1)n) a_{u+vn} = a_{u+vn} - a_{u} = \sum_{t=1}^{v} \left(a_{u+tn} - a_{u+(t-1)n}\right)
for all 1≤u,v≤n1 \leq u, v \leq n. If v<n−u+1v < n-u+1 then all terms are 0 on the right-hand side. If v≥n−u+1v \geq n-u+1, then variable tt attains the value n−u+1n-u+1 once. Hence,
au+vn={0,u+v≤n1,u+v≥n+1 a_{u+vn} = \begin{cases}0, & u+v \leq n \\ 1, & u+v \geq n+1\end{cases}
according with (1). Note that the formula is valid for v=0v=0 as well.

Finally, we presented the direct formula for (ai)\left(a_{i}\right), and we have proved that it satisfies condition (a). So, the solution is complete.

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.