Maths Olympiad Prep

Library / /131 of 133

, 2015

Combinatorics Difficulty 7.6 National olympiad, round 2 Prove it Saudi Arabia

Find the number of binary sequences SS of length 20152015 such that for any two segments I1,I2I_{1}, I_{2} of SS of the same length, we have
- The sum of digits of I1I_{1} differs from the sum of digits of I2I_{2} by at most 11;
- If I1I_{1} begins on the left end of SS then the sum of digits of I1I_{1} is not greater than the sum of digits of I2I_{2};
- If I2I_{2} ends on the right end of SS then the sum of digits of I2I_{2} is not less than the sum of digits of I1I_{1}.

Solution

Note that if the sequence SS ends with zero then all digits of SS will be zero.

Now suppose that the sequence SS ends with one. Let kk be the number of 11's in SS then 1k20151 \leq k \leq 2015. Let α=2015k1\alpha = \frac{2015}{k} \geq 1. We consider the sequence Sk=a1a2a2015S_{k} = a_{1} a_{2} \ldots a_{2015} where ai=1a_{i} = 1 if and only if i{α,2α,,kα}i \in \{ \lceil \alpha \rceil, \lceil 2 \alpha \rceil, \ldots, \lceil k \alpha \rceil \}.

One can check that this sequence has exactly kk ones and satisfies all the given conditions.

Now we need to prove that those are all possible sequences.

Suppose that SS is a sequence with exactly kk ones and also satisfying all the given conditions. We will show that we have only one possible arrangement for kk ones and (2015k)(2015 - k) zeros.

Let β=2015k2015\beta = \frac{2015 - k}{2015}. Starting from the right, we will show that for any 1s20151 \leq s \leq 2015, among the first ss rightmost digits, there are exactly βs\lfloor \beta s \rfloor zeros.

It is clear that the statement holds for s=1s = 1 since the rightmost digit is a unit.

Suppose that the statement holds for ss. We consider two cases.

Case 1. If β(s+1)=βs+1\lfloor \beta(s+1) \rfloor = \lfloor \beta s \rfloor + 1. We need to show that the (s+1)th(s+1)^{\text{th}} rightmost digit of SS is zero. Otherwise, it follows that we have exactly β(s+1)1\lfloor \beta(s+1) \rfloor - 1 in the (s+1)(s+1) rightmost digits and any s+1s+1 consecutive digits, there are at most β(s+1)\lfloor \beta(s+1) \rfloor zeros. We divide the sequence from the right into tt segments of length s+1s+1 and possibly one leftmost segment of length ss' with 0ss0 \leq s' \leq s.

The number of zeros is at most
β(s+1)1+(t1)β(s+1)+βsβ(t(s+1)+s)1=2014k \begin{aligned} \lfloor \beta(s+1) \rfloor - 1 & + (t-1) \lfloor \beta(s+1) \rfloor + \left\lfloor \beta s' \right\rfloor \\ & \leq \beta \left( t(s+1) + s' \right) - 1 = 2014 - k \end{aligned}
which is a contradiction.

Case 2. If β(s+1)=βs\lfloor \beta(s+1) \rfloor = \lfloor \beta s \rfloor. We need to show that the (s+1)th(s+1)^{\text{th}} rightmost digit of SS is a unit. Otherwise, it follows that for any s+1s+1 consecutive digits, there are at least β(s+1)+1\lfloor \beta(s+1) \rfloor + 1 zeros. We divide the sequence from the right into tt segments of length s+1s+1 and possibly one leftmost segment of length ss' with 0ss0 \leq s' \leq s. Note that in the first ss' rightmost digits, we have exactly βs\left\lfloor \beta s' \right\rfloor zeros. If in the leftmost segment of length ss' we have βs+1\left\lfloor \beta s' \right\rfloor + 1 then the number of zeros is at least
t(β(s+1)+1)+βs>β(t(s+1)+s)=2015k t (\lfloor \beta(s+1) \rfloor + 1) + \left\lfloor \beta s' \right\rfloor > \beta ( t(s+1) + s' ) = 2015 - k
which is a contradiction.

We deduce that, in each segment of length ss' we have exactly βs\left\lfloor \beta s' \right\rfloor zeros. We divide the sequence into segments of length ss' and possible one shorter segment from the left. Using the same argument as in the previous case, we do not have enough zeros, which is again a contradiction.

Therefore, the statement holds for all 1s20151 \leq s \leq 2015, which implies that for any 0k20150 \leq k \leq 2015, there exists a unique binary sequence with kk units satisfying the given conditions.

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.