Let $ n > 1$ be an integer. Find all sequences $ a_1, a_2, \ldots a_{n^2 + n}$ satisfying the following conditions: \[ \text{ (a) } a_i \in \left\{0,1\right\} \text{ for all } 1 \leq i \leq n^2 + n; \] \[ \text{ (b) } a_{i + 1} + a_{i + 2} + \ldots + a_{i + n} < a_{i + n + 1} + a_{i + n + 2} + \ldots + a_{i + 2n} \text{ for all } 0 \leq i \leq n^2 - n. \] Author: Dusan Dukic, Serbia
Problem
Source: IMO Shortlist 2007, C1, AIMO 2008, TST 1, P1
Tags: combinatorics, Sequence, IMO Shortlist, inequality system, induction
17.07.2008 08:40
$ a_{kn + i} = 0$ if $ 0 \leq i \leq n - k$ and $ a_{kn + i} = 1$ if $ n - k < i \leq n$ Let $ b_i = a_{i\cdot n + 1} + a_{i \cdot n + 2} + \cdots + a_{(i + 1)n}$ then $ 0 \leq b_0 < b_1 < \cdots b_n \leq n \Rightarrow b_i = i$ suppose $ a_{s n + t}$ is greatest element satisfy $ a_{s n + t}$ such that $ a_{sn + t} = 0$ and $ n - s < t \leq n$ Let $ c_i = a_{i \cdot n + 1} + a_{i \cdot n + 2} + \cdots + a_{i \cdot n + t - 1}$ and $ d_i = a_{i \cdot n + t} + a_{i \cdot n + t + 1} + \cdots + a_{(i + 1)n}$ $ 0 = d_0 + c_1 < d_1 + c_2 < \cdots d_s + c_{s + 1} = s - 1 \Rightarrow d_i + c_{i + 1} = i (i \leq s)$ $ b_i - (d_i + c_{i + 1}) = c_i + d_i - d_i - c_{i + 1} = 0 \Rightarrow c_i = c_{i + 1} (i \leq s)$ because $ c_0 \leq b_0 \Rightarrow c_0 = 0 \Rightarrow c_s = 0$ But $ d_s \leq s - 1$ because $ a_{sn + t} = 0$ then $ b_s = c_s + d_s \leq s - 1$ Contradiction!!
27.07.2008 23:37
I have the exact same solution as nayel . It's nice.
27.03.2011 02:32
We induct on $n\ge1$ to show that $a_{kn+i}=1$ ($0\le k\le n$ and $1\le i\le n$) iff $k\ge i$, where the base case is clear. Let $s_i=a_i+\cdots+a_{i+n-1}$. Note that $0\le s_i\le n$ for all $0\le i\le n^2+1$. Since \[s_1 < s_{n+1} < \cdots < s_{n^2+1},\]we have $s_{kn+1}=k$ for $0\le k\le n$. In particular, \[a_1=\cdots=a_n=0\wedge a_{n^2+1}+\cdots+a_{n^2+n}=1.\]Thus \begin{align*} A = s_2+s_{n+2}+\cdots+s_{(n-1)n+2} &= s_{n+1}+s_{2n+1}+\cdots+s_{(n-1)n+1}+1 \\ &= 1+2+\cdots+(n-1)+1 = B. \end{align*}However, $s_2<s_{n+2}<\cdots<s_{(n-1)n+2}$ gives us $s_{kn+2}\in[k,k+1]$ for $0\le k\le n-1$. If $s_{(n-1)n+2}=n-1$, though, we must have \[A = s_2+s_{n+2}+\cdots+s_{(n-1)n+2} \le 1+2+\cdots+(n-1) < B,\]a contradiction. So $s_{(n-1)n+2}=n$, whence \[B-n = 1+2+\cdots+(n-2) \ge s_2+s_{n+2}+\cdots+s_{(n-2)n+2} = A-s_{(n-1)n+2} = A-n\]and so $s_{kn+2}=k=s_{kn+1}$ for $0\le k\le n-2$. Letting $k$ range from $0$ to $n-2$, we find that \[0=a_1=a_{n+1}=\cdots=a_{(n-1)n+1}.\]But $s_{(n-1)n+1}=n-1$, so \[a_{(n-1)n+2}=\cdots=a_{(n-1)n+n}=1.\] It's now easy to see that $a_{kn+i}$, for $0\le k\le n-1$ and $2\le i\le n$ satisfy the inductive hypothesis, so we're done. (Visualizing the numbers in a $(n+1)\times n$ matrix also helps.)
31.03.2016 16:57
Can someone read my solution and give feedback on how to structure/word it better? Thanks
EDIT: Sorry about the weird formatting, I don't know of a good way to split formulas in half other than doing it manually
22.08.2016 22:51
Felt more like an Algebra problem to me. Annoying indexing, wow. There must be an easier solution than mine, though, lol. We claim that the only possible sequence is \begin{align*} a_1=a_2=\dots=a_n &=0 \\ a_{n+1}=a_{n+2}=\dots=a_{2n-1}=0, \ a_{2n}&=1 \\ a_{2n+1}=a_{2n+2}=\dots=a_{3n-2}=0, \ a_{3n-1}=a_{3n} &=1 \\ &\dots \\ a_{n^2}=a_{n^2+1}=\dots=a_{n^2+n} &=1 \end{align*}Note the chain of inequalities \[ 0 \leq a_1+\dots+a_n < a_{n+1}+\dots+a_{2n} < \dots < a_{n^2+1}+\dots+a_{n^2+n} \leq n. \]As those sums are all integers and there are exactly $n$ strict 'less than'-signs, we can conclude $\sum_{i=1}^{n} a_{kn+i} = k$ for $0 \leq k \leq n$. Furthermore, note \[ 0 \leq \sum_{i=j}^{n+j-1} a_i < \sum_{i=j}^{n+j-1} a_{n+i} < \dots < \sum_{i=j}^{n+j-1} a_{n^2+i} \leq n \]for $2 \leq j \leq n$. Now those are exactly $n-1$ strict inequality signs. Thus $k \leq \sum_{i=j}^{n+j-1} a_{kn+i} \leq k+1$. Now we'll induct. Base Case: Notice $a_1=a_2=\dots=a_n=0$, as $\sum_{i=1}^{n} a_i=0$. Induction Hypothesis: Let $(a_{kn+1},a_{kn+2},\dots,a_{(k+1)n}) = (0,0,\dots,0,1,1,\dots,1)$ where we have $k$-times the $1$. Induction Step: We'll prove $(a_{(k+1)n+1},a_{(k+1)n+2},\dots,a_{(k+2)n})=(0,0,\dots,0,1,\dots,1)$ with $k+1$-times the $1$. As for that, we'll induct again to show \[ a_{(k+1)n+1}=a_{(k+1)n+2}=\dots+a_{(k+1)n+n-k-1}=0. \]By $\sum_{i=1}^n a_{(k+1)n+i}=k+1$ we'd be done. Assume $a_{(k+1)n+1}=1$. Then \[ k+1=a_{kn+2}+a_{kn+3}+\dots+a_{(k+1)n+1} < a_{(k+1)n+2}+a_{(k+1)n+3}+\dots+a_{(k+2)n}+a_{(k+2)n+1} \leq k+1 \]by the Induction Hypothesis. Contradiction. Thus $a_{(k+1)n+1}=0$. So now assume \[ a_{(k+1)n+1}=a_{(k+1)n+2}=\dots=a_{(k+1)n+i} = 0 \quad \text{for all} \quad i \leq N \leq n-k-2. \]Again assume $a_{(k+1)n+i+1}=1$. Then \begin{align*} k+1 = a_{kn+i+2}+\dots+a_{(k+1)n+i+1} <k+2 &\leq a_{(k+1)n+i+2}+\dots+a_{(k+2)n+i+1} \\ < k+3 &\leq a_{(k+2)n+i+2}+\dots+a_{(k+3)n+i+1} \\ \dots \\ < k+i+2 &\leq a_{(k+i+1)n+i+2}+\dots+a_{(k+i+2)n+i+1}. \end{align*}Here we've used that $a_{(k+1)n+i+2}+\dots+a_{(k+2)n}=k$ Thus $a_{(k+2)n+1}+\dots+a_{(k+2)n+i+1}=2$. With that $a_{(k+2)n+i+2}+\dots+a_{(k+3)n}=k$ and thus $a_{(k+3)n+1}+\dots+a_{(k+3)n+i+1}=3$ and so on. But the last line suggest \[ a_{(k+i+2)n+1}+a_{(k+i+2)n+2}+\dots+a_{(k+i+2)n+i+1} = i+2. \]But those are just $i+1$ terms. Contradiction. It's easy the verify that those indizes are well-defined for what we need. That ends the induction and thus also the other induction. It's easy to check that the claimed sequence indeed is a solution.
27.10.2016 12:48
For $1\leq k\leq n^2-n+1$, let $b_k = a_k + a_{k+1} + \cdots + a_{k+n-1}$. It follows from the conditions given that $b_1<b_{n+1}<\cdots <b_{n^2+1}$, but each of these numbers is an integer from $0$ to $n$ inclusive, hence all these integers appear exactly once, and $b_1=0, b_{n^2+1} = n$. So the first $n$ terms of the sequence are $0$ and the last $n$ terms are $1$. Let $S_i = \{ b_i, b_{i+n}, \cdots b_{i+n^2-n}\}$ for $2\leq i \leq n$. This is a strictly increasing sequence of $n$ integers from $0$ to $n$ inclusive. Let their sum be $T$. Also, $a_1+a_2+\cdots +a_{n^2+n} = 0+1+\cdots +n= T + (n-i+1)$. Here we used the fact that the first $n$ terms are $0$ and the last $n$ terms are $1$. Thus the missing element in $S_i$ is precisely $n-i+1$. Now we have shown that each sum of $n$ consecutive terms is uniquely determined, so there's at most one such sequence. It is obvious that $B_1B_2\cdots B_{n+1}$ works, where these are blocks of $n$ terms, and in $B_i$ everything is $0$ except for the last $i$ terms.
18.04.2017 07:41
02.08.2017 18:07
Wrong solution
21.11.2017 21:45
The only possible config is have for each $i$th block of $n$ terms from left consisting of $n-i$ zeros and then $i$ ones. First, consider all blocks of $n$ $a_i$'s such that the first term $a_j$ of each block has $j \equiv 1 \pmod{n}$. There are $n+1$ such blocks and since they are disjoint, the blocks must have sums $0, 1, \cdots n$ respectively from left to right. Then consider all blocks of $n$ such that first term $a_j$ of each block has $j \equiv 2 \pmod{n}$. There are $n$ such blocks and by the previous observation the sums of all terms in these blocks is $\frac{n(n+1)}{2}-(n-1)$. The sums on these blocks are distinct and so it must be that their sums are $0, 1, \cdots n-2, n$ respectively from left to right. Then we can fill out $0$'s and $1$'s from right to left and we see that we are forced to have the said configuration.
03.08.2018 07:45
There is a unique valid sequence, which is described below: [asy][asy] int n = 6; for (int i = 0; i < n; i += 1) { draw((n-1, -i)--(0, -i-1), gray(0.6)); } for (int i = 0; i <= n; i += 1) { draw((0, -i)--(n-1, -i), gray(0.6)); } for (int i = 0; i < n; i += 1) { for (int j = 0; j <= n; j += 1) { label(string(i + j >= n ? 1 : 0), (i, -j)); } } [/asy][/asy] It is clear that this works. Now we show it is the only one. Write the sequence as an $(n+1) \times n$ matrix as above; then by condition the row sums are $0, \dots, n$ in order. In particular the top row is all-zero while the bottom row is all-one. Define the partial sums $s_k = a_1 + \dots + a_k$, and let $i \in \{1, \dots, n-1\}$ be an integer. Then the $n$ nonnegative integers \[s_{i+n} - s_i, s_{i+2n} - s_{i+n}, \dots, s_{i+n^2} - s_{i+n^2-n}\]form a strictly increasing sequence and sum to \[s_{i+n^2} - s_i = (0 + 1 + \dots + n) - (n - i)\]and so must be exactly $\{0, 1, \dots, n\} \setminus \{n-i\}$ in order. In particular each $s_{k+n} - s_k$ is forced, so in light of $a_1 = \dots = a_n = 0$ the entire sequence is forced.
21.04.2019 21:14
It seriously felt like an algebra problem. orl wrote: Let $ n > 1$ be an integer. Find all sequences $ a_1, a_2, \ldots a_{n^2 + n}$ satisfying the following conditions: \[ \text{ (a) } a_i \in \left\{0,1\right\} \text{ for all } 1 \leq i \leq n^2 + n; \]\[ \text{ (b) } a_{i + 1} + a_{i + 2} + \ldots + a_{i + n} < a_{i + n + 1} + a_{i + n + 2} + \ldots + a_{i + 2n} \text{ for all } 0 \leq i \leq n^2 - n. \]Author: Dusan Dukic, Serbia We claim that the only sequence possible is the following: $$\underbrace{0,0,\cdots 0}_{n}\underbrace{0,0, \cdots,0,1 }_{n}\underbrace{0,0, \cdots,0,1,1 }_{n} \cdots \underbrace{1,1, \cdots,1,1 }_{n}$$It is not hard to see that this works. Now we show that this is the only possibility. Let $\mathcal{T}(k)$ denote the number of $1$s in the block $[a_{k}, a_{k+n+1}].$ Then the condition translates to $\mathcal{T}(k)<\mathcal{T}(k+n)$ for all $0 \le k \le n^2-n.$ For simplitcity, define $f$ by $f_i(k)=\mathcal{T}(ni+k).$ For instance, when $n=3;$ $$0, \underbrace{0,0,0}_{f_2(0)=0}\underbrace{0,1,0}_{f_2(1)=1}\underbrace{1,1,1}_{f_2(2)=3},1,1$$ We will now show that each $\mathcal{T}(k)$ has a unique value. Since the solution given before works, hence it would be the only solution. Clearly $\mathcal{T}(ni+1)=i$ for all $1 \le i \le n.$ In particular the first $n$ elements are zeros while the last $n$ elements are $1$s. Thus by comparing terms we see \begin{align*} f_2(0)+f_2(1)+\cdots +f_2(n-1) &=f_1(0)+f_1(1)+\cdots f_1(n)-0- \underbrace{\left(1+1+\cdots+1\right)}_{n-1} \\ f_2(0)+f_2(1)+\cdots +f_2(n-1) &=0+1+\cdots+(n-1)+1 \end{align*}Noting that $f_2(i)<f_2(j)$ for all $i<j$ gives a unique value designation to each of $f_2(i).$ In fact, this is $f_2(i)=i$ for all $0 \le i \le n-2$ and $f_2(n-1)=n.$ We can further repeat this procedure to assign values to each of $f_3(i), f_4(i), \cdots.$ and hence conclude the result. $\square$ EDIT: I realized that this is just a detailed form of the above solution.
27.05.2020 20:55
First, note that by the given inequality, we have $$a_1+a_2+\dots+a_{n}<a_{n+1}+a_{n+2}+\dots+a_{2n}<\dots<a_{n^2+1}+a_{n^2+2}+\dots+a_{n^2+n}.$$Since there are only $n+1$ possible values of the sum of any $n$ consecutive terms of the sequence, this implies that $$a_1+a_2+\dots+a_{n}=0,$$$$a_{n+1}+a_{n+2}+\dots+a_{2n}=1,$$$$\vdots$$$$a_{n^2+1}+a_{n^2+2}+\dots+a_{n^2+n}=n.$$In particular, the first $n$ terms must be $0$ and the last $n$ terms must be $1.$ We claim that for $i\in\{1,2,\dots,n\},$ we have $$a_{i}=a_{n+i}=\dots=a_{(n-i)n+i}=0,$$$$a_{(n-i+1)n+i}=a_{(n-i+2)n+i}=\dots=a_{n^2+i}=1.$$To show this, we induct backwards on $i.$ For the base case $i=n,$ let $x_k=a_{kn+1}+a_{kn+2}+\dots+a_{kn+n-1}$ for $k\in\{1,2,\dots,n-1\}.$ Using our work before and the given inequality, we have $$x_1<1-x_1+x_2<2-x_2+x_3<\dots<n-x_{n-1}+n.$$Since $x_k\in\{k-1,k\}$ for all $k,$ the only solution to this inequality is $x_k=k-1$ for all $k,$ implying the claim. Now suppose the claim is true for $i=n,n-1,\dots,m,$ and let $x_k=a_{kn+1}+a_{kn+2}+\dots+a_{kn+m-2}$ for $k\in\{1,2,\dots,n-1\}.$ By the given inequality, $$x_1<2-x_1+x_2<2-x_2+x_3<\dots<n-x_{n-1}+n.$$But by the inductive hypothesis, we know $x_k=0$ if $k\le n-m+1$ and $x_k\in\{k-n+m-2,k-n+m-1\}$ if $k>n-m+1.$ Therefore, the only solution is $x_1=x_2=\dots=x_{n-m+1}=0$ and $x_{k}=k-n+m-2$ for $k>n+m-1,$ implying the claim. We are done by induction.
19.12.2020 09:21
It will be helpful to define the following notation: Let the 1-block be the $n$ numbers from $a_1$ to $a_n$, define 2-blocks, etc analogously. Additionally, let $S(m, x)$ be the sum of the numbers from indices $m$ to $x$. Notice that \begin{align*} S(1, n) < S(n + 1, 2n) < \cdots < S(n(n - 1) + 1, n^2) < S(n^2 + 1, n^2 + n). \end{align*}There are $n + 1$ blocks total, and the only possible sums are $0$ to $n$. Thus, 1-block has sum 0, 2-block has sum 1, and so forth. Now, we claim that the only possible sequence is when the ones in each block are pushed as far to the right as possible; for example, the two $1$s in the 3-block would be pushed to $3n$ and $3n - 1$. For our base case, assume that the $1$ in the $2$-block appears at index $n + j$, where $j < n$ for contradiction. Then, draw new boxes from $j + 1$ to $n + j$, and so forth. Evidently, \begin{align*} 1 = S(j + 1, n + j) < S(n + j + 1, 2n + j) < \cdots < S(n(n - 1) + j + 1, n^2 + j), \end{align*}which forces there to be $1, 2, \cdots, n$ ones in each of the new boxes. Observe now that $S(n(n - 1) + j + 1, n^2)$ is all ones for a total of $n - j$ ones (this is because the n+1-block is all ones). By similar logic, we need $S(n(n - 1) + 1, n(n - 1) + j) = j - 1$, but then this forces $S(n(n - 2) + j + 1, n(n - 1)) = n - j$ and so forth which is a contradiction. The inductive step is near identical to the base case. The only difference is that we note that the $k + 1$th block has its earliest $1$ at $n - k$, and as a result the boxes we draw in the inductive step will contain all the pushed-forward ones in the $k$th block. That was all a little dense, so here's an illustrative example. Let's take a look at the sequence $0000, 00 | 01, 01| |--, --| |--, 11|11$. The dashes represent the new boxes we draw in the inductive step, call them Crates 1, 2, and 3. Crate 1 has a sum of $2$, and because there are three crates total, we know from the givens that Crate 2 must have a sum of 3, and Crate 3 has a sum of 4. As a result, our new sequence is $0000, 00 | 01, 01| |--, (--)| |11, 11|11$. However, because we know that box 4 must contain $3$ ones total, we know that the parenthesed area can only contain one $1$ at maximum. As a result, we are forced to draw the following: $0000, 00 | 01, 01| |11, --| |11, 11|11$, which is a contradiction since Box 3 here has a sum of $3$ which is too much.
21.03.2021 05:48
It is clear that $a_1+a_2+\cdots+a_n<a_{n+1}+\cdots+a_{2n}<\cdots<a_{n^2+1}+\cdots+a_{n^2+n}$. There are $n+1$ sums, so the first is $0$, the next is $1$, etc. In particular, $a_1=a_2=\cdots=a_n=0$ and $a_{n^2+1}=a_{n^2+2}=\cdots = a_{n^2+n}=1$. We claim that $a_{n+n}$ is the sole nonzero $a_{n+i}$ among $1\le i\le n$. This is because otherwise considering the sums $a_{kn+i+1}+\cdots+a_{kn+n+i}$ for $0\le k\le n-1$ implies that each successive sum contains all nonzero elements of $a_{kn+n+1},a_{kn+n+2},\dots,a_{kn+2n}$. A similar argument implies that only $a_{3n}$ and $a_{3n-1}$ of $a_{2n+1},\dots,a_{3n}$ are nonzero. Continuing on this way, we can uniquely characterize the sequence as the one for which each $a_{kn+i}$ with $1\le i\le n$ is nonzero iff $n+1-k\le i$. It is not hard to check this sequence works, so done.
04.04.2021 04:13
I claim that there is one unique solution. We proceed with induction on $n$,the base case is trivial and we obviously have one unique solution ($a_1<a_2$). Now the inductive step: Write $s_i = a_{i+1}+\ldots a_{i+n}$. Then, note that we have \[0\leq s_0 < s_n < \cdots s_{(n-1)\cdot n} < s_{n^2} \leq n\]Thus, since these values are integers, and we have $n+1$ choices and $n+1$ values, we have $s_{nk} = k$ for all $k$. Now, let $i$ be the smallest $i$ such that $a_i=1$. Note that we are guaranteed that $n+1\leq i \leq 2n$. Thus, \[1\leq s_{i-n}< s_i < s_{i+n}\ldots s_{i+(n-2)n}\leq n\]There are $n$ choices, and $n$ values, so we have $s_{i+nr} = r+2$. Importantly, \[\sum_{k=0}^{n} s_{nk} = \sum_{r=-1}^{n-2} s_{i+nr}\]Thus, since the LHS represents all 1s, all 1s must also be in the $i+nr$ ranges, so there cannot be any 1s in between $i+(n-2)n$ and $n^2+n$, but this is absurd because $s_{n^2}=n$ guarantees that for all $n^2+1\leq x\leq n^2+n$, $a_x=1$. Thus, we must have that \[i+(n-2)n=n^2 \Longrightarrow i=2n\]By considering $s_{nk-1}$ \[2\leq s_{2n-1} < s_{3n-1} < \ldots < s_{n^2-1} \leq n\]we get that $s_{nk-1}=k$. Thus, we must have that $a_{3n}=1$ and so on so that $a_{nk}=1$ for all $k\geq 2$. Thus, we can now remove $(1,2,\ldots n)$ and $(2n,3n,\ldots n^2+n)$, at which point we have reduced to the $n-1$ case because we've removed exactly 1 from each series of $n$. Thus, by the inductive hypothesis there is exactly one solution. We can construct such a construction by taking a pattern of the form $a_{kn-r}=1$ for $0\leq r<n$ if and only if $r\leq k-2$.
29.12.2021 03:09
09.01.2022 22:15
Break the sequence into $n+1$ groups of $n$ numbers each. Using the second condition for multiples of $n$, we get that the amount of $1$s in a group increases with the position of the group. As there are only $n+1$ possible values for the number of $1$s in a group, the $i$th group will have $i-1$ ones. We claim that the answer consists of the $i$th group consisting of $i-1$ ones at the end of the group, and zeros at the beginning where needed. This can be shown to work. We will prove this using induction. It is easy to show this for $n=2$. Suppose that the claim is true for $n=k-1$. We will prove the statement for $n=k$. Claim: For any $n$, the last number of every group other than the first must be a $1$. Proof. Suppose that the last number in the $x$th group is $0$, where $x>1$. Plugging in $(n-1)x-1$ into the second condition gives us that the sum of the last number of the $x-1$th group and the first $n-1$ numbers of the $x$th group is less than the sum of the last number of the $x$th group and the first $n-1$ numbers of the $x+1$st group. However, the former is at least $x-1$ and the latter is at most $x$, so equality must hold, meaning all the ones in the $x+1$st group are in the first $n-1$ numbers. This means that the last number in the $x+1$th group is $0$. Continuing this reasoning, we will eventually get that the last number of the last group, or $a_{n^2+n}$, is $0$, which is impossible. $\blacksquare$ Consider the sequence consisting of the $k^2-k$ numbers $a_{ln+m}$ for $1\le l\le k, 1\le m\le k-1$ in order. We claim that this sequence satisfies both conditions for $n=k-1$. Indeed, the first condition is obviously satisfied. The second condition is equivalent to the second condition for the $n=k$ sequence because we simply take out the last number out of a group (for the $n=k$ sequence) for each side, which is $1$ by the claim. Therefore, by the induction hypothesis, there is only one possibility for $a_{ln+m}$ for $1\le l\le k, 1\le m\le k-1$. All other values are already determined, and combining these with the fixed values for $a_{ln+m}$ for $1\le l\le k, 1\le m\le k-1$, we get the answer stated above. The induction is complete, and we are done.
07.07.2022 00:13
Let $b_i=a_i+a_{i+1}+\dots+a_{i+n}$. Trivially, we obtain $b_{kn+1}=k$, due to the second condition. It follows that $b_{n^2+1}=n$ or that $a_i=1$ for all $n^2+1\le i\le n^2+n$. Now, we have that \[\sum_{k=0}^nb_{kn+1}=\sum_{k=1}^{n^2+n}a_k=\frac{n(n+1)}{2}=s_1\]\[\sum_{k=0}^{n-1}b_{kn+2}=\sum_{k=2}^{n^2+1}a_k=s_1-(n-1)=s_2\]\[\vdots\]\[\sum_{k=0}^{n-1}b_{kn+n}=\sum_{k=n}^{n^2+n-1}a_k=s_1-1=s_n.\]Now, consider the sequence $b_i, b_{n+i}, \dots, b_{n^2-n+i}$ for some $1<i\le n$. It's easy to see that this sequence contains every number from $0$ to $n$, inclusive, except for one. From our sums earlier, we obtain that this number is actually $n+1-i$. Now, I claim that the sequence $b_{kn+1}$ to $b_{kn+n}$ contains $k$ copies of $k+1$ and $n-k$ copies of $k$, in sorted order. We show this by induction. The base case ($k=0$) is trivial. Now, suppose that $k-1$ satisfies the given. Then clearly we have $b_{kn+i}=b_{kn+i-n}+1$ for all $1\le i\le n$ except for $i=n-k+1$, in which case we obtain $b_{kn+n-k+1}=b_{kn-k+1}+2$. This implies the result. Finally, I claim that $\boxed{\text{the sequence }a_{kn+1}\text{ to }a_{kn+n}\text{ contains }n-k\text{ copies of }0\text{ and }k\text{ copies of }1\text{ in sorted order}}$. We show this by induction; the base case is trivial. Consider $b_{kn+1-k}$ and the sequence $a_{kn+2-k}$ to $a_{kn}$. Clearly this sequence contains all of the $1$s that contribute to the sum in $b_{kn+1-k}$. It follows that all values from $a_{kn+1}$ to $a_{kn+n-k}$ are equal to $0$. However, $b_{kn+1}$ is equal to $k$, which implies that the $k$ elements from $a_{kn+n-k+1}$ to $a_{kn+n}$ are equal to $1$. Therefore, we are done. $\blacksquare$
18.07.2022 21:10
Let $s_i=a_{i + 1} + a_{i + 2} + \ldots + a_{i + n},0\le s_n\le n.$ Note that $s_0<s_n<\dots<s_{n^2}$ so $s_{kn}=k.$ In particular, $a_1=a_2=\dots=a_n=0,a_{n^2+1}=a_{n^2+1}=\dots=a_{n^2+n}=1$ Let $1\le k\le n-1$, then $s_k< s_{k+n}<\dots < s_{k+n^2-n}$ and $s_k+s_{k+n}+\dots+s_{k+n^2-n}=\frac{n(n+1)}{2}-(n-k)$ which means that this sequence contains every integer from $1$ to $n$ excluding $n-k.$ Thus, from $a_1=a_2=\dots=a_n=0,a_{n^2+1}=a_{n^2+1}=\dots=a_{n^2+n}=1$ we get the same construction everyone else has posted.
06.01.2023 10:55
We claim that the in the sequence, the first $n$ terms are all 0, in the next $n$, only the last term is 1, in the next $n$, only the last 2 terms are 1, and so on, until in the last $n$, all terms are 1. This sequence clearly works. Note that each block of $n$ must contain strictly more 1's than the previous block. This implies that there must be no 1's in the first $n$, one 1 in the next $n$, two 1s in the next $n$, and so on until $n$ ones in the last $n$. Consider the prefix sums of this sequence. We will put the prefix sums in $n+1$ rows of $n$ each so that when the grid is read by rows, it gives the prefix sum sequence. Note that by our earlier observation, the last column must contain $0,1,3,6\cdots n(n+1)/2.$ Additionally, condition (b) is equivalent to each column forming a strictly convex sequence. Now, consider the second to last column of these prefix sums. This column must end in $n(n+1)/2 -1$ since the final $n$ terms are all 1's, so the final row of this grid contains consecutive integers. However, note that the minimal convex sequence starting with $0,1$ with a length of $n+1$ ends with $n(n+1)/2$, contradiction, so the second to last column must start with $0,0$ instead. Note that consecutive prefix sums can differ by no more than 1, so the second to last column must be $0,0,2,5,9,14\cdots n(n+1)/2 -1.$ We can then repeat this argument with previous columns. For example, in the third to last column, it must start with $0,0,1$ since the minimal convex sequence starting in $0,0,2$ reaches $n(n+1)/2-1$ on term $n+1$, but it needs to end in $n(n+1)/2-2,$ so it must start in $0,0,1$, and we can also use the argument that it can never fall behind the second to last column by more than 1. Repeating this argument with all previous columns, we get a unique possible grid of prefix sums, from which we can uniquely recover the original sequence, and since the sequence we showed earlier works, we are done.
12.02.2023 19:54
Odd problem. Divide the sequence into subsequences $s_1 = (a_1, a_2, \dots, a_n)$, $s_2 = (a_{n+1}, a_{n+2}, \dots, a_{2n})$, and so on. The only such sequences are those with $s_i = (0, 0, 0, \dots, 1, 1, \dots, 1)$, where there are $i-1$ ones consecutively. To prove this, notice that each subsequence $s_i$ contains a strictly greater number of ones than any previous subsequence; by Pigeonhole it follows that it must contain exactly $i-1$ ones. Now, suppose for the sake of contradiction that there exists a minimal index $k$ for which $s_k$ contains a one before index $n-k+2$ in that subsequence. Call this index $i$. By minimality, we know that the $n$ digits leading up to index $i$ (spanning two subsequences) contains at least $k-1$ ones because due to the condition $i \leq n-k+1$, all zeroes at the tail of the previous subsequence are contained in these $n$ digits. This means that there are at least $k$ ones in the $n$ digits immediately following; in other words, all $k$ ones in the subsequence $s_{k+1}$ must fall in these $n$ digits, and thus strictly before the index $n-k+2$ in that sequence. This implies that the next list $s_{k+1}$ also satisfies the aforementioned condition, so inductively, the list $s_{n+1}$ must also satisfy this condition. But this is absurd, because clearly there are no elements of $s_{n+1}$ that are before the element indexed $n-(n+1) + 2 = 1$.
18.03.2023 19:15
We claim that there is one unique sequence. First, we will construct this sequence, which will be made up of $n+1$ blocks of $n$ digits. The first block will be of $n$ zeros, the next will be of $n-1$ zeros with the last digit being $1$, and the second block will have the last two digits as $1$, and so on and so forth. E.g. for $n=3$, we have the sequence $000001011111$. Clearly this construction works, as for each time we "increase" or move to the next block of $n$ numbers from any block of $n$ numbers(not necessarily the ones specified in the previous definition, a "block" could mean index $2$ to index $n+1$), we "exchange" a zero for a $1$, adding one to the sum. Now we must prove that there are no other sequences. Notice that if we section off the $n^2+n$ numbers into $n+1$ disjoint blocks of $n$ (there is only one way to do this), we have that the sum of the first block must be $0$, the next is $1$, and so on and so forth, since these sums must be increasing. Using this and filling out the sequence from left to right, we find that we must have the configuration, and we are done. FS found by bobthegod78 Now we must prove that there are no other sequences. Let the variable $S_{m,m+k}$ for $k>0$ denote the sum $a_m+a_{m+1}+a_{m+2}+\dots{}+a_{m+k}$. Notice that \[S_{1,n}<S_{n+1,2n}<S_{2n+1,3n}<\dots{}S_{n^2+1,n^2+n}\]which means that $S_{cn+1,cn+n}=c$ for any integer $c$ from $0$ to $n$ inclusive. Now we will prove that $a_{n+1}=a_{n+2}=\dots{}=a_{2n-1}=0$, and $a_{2n}=1$. Notice that since $S_{n+1,2n}=1$, we have that exactly one of the $n$ values between $a_{n+1}$ and $a_{2n}$ is $1$, and because $S_{1,n}=0$, we also must have that $a_1=a_2=\dots{}=a_n=0$. FTSOC, assume that $a_{n+1}=1$. From the condition, we have that \[S_{2,n+1}<S_{n+2,2n+1}<\dots{}S_{n^2-n+2,n^2+1}\]and since $S_{2,n+1}=1$, we must have that $S_{n+2,2n+1}=2$. However, this implies that $a_{2n+1}=2$, a clear contradiction. Similarly, if we let $a_{n+c}=1$ for some $0<c<n$, we will find that it implies that $a_{cn+1}=2$, a contradiction. Therefore, we must have that $a_{2n}=1$. Similarly, we can do this for the other $n-1$ blocks of binary with sums $2$, $3$, $\dots$, $n-1$ by focusing on the first $1$ that appears in that block, and we can conclude that it will always be $a_{cn-c+2}=a_{cn-c+3}=\dots{}=a_{cn}=1$. Therefore there is only one sequence, and we are done.
23.04.2023 18:40
17.06.2023 22:25
We compare the $n+1$ groups of $n$ integers from beginning to the end. We can see that since there are $n+1$ possible values of the sum, the $n$th group must sum to $n-1$. We claim that the only configuration is when those $n-1$ $1$'s are at the end of that group. Specifically, for $n = 4$ our configuration is: \[00000001001101111111\] We can see that this works since there are always increments for every increment in $n$ We claim by induction that we cannot have $a_x = 1$ where $x = y \cdot n + z$ where $y$ and $z$ are integers with $0 \leq y \leq n$ and $0 \leq z \leq n-y$. Our base case is trivial. Now for the inductive step. If we have $x = 1$, then we can compare the $n$ groups of $n$ numbers from \[ \{a_{z+1} \ldots a_{n+z} \}, \{a_{n+z+1} \ldots a_{2n+z} \} , \ldots \{a_{n^2 - n +z+1} \ldots a_{n^2 + z} \} \]. We can see from our inductive step that for each of first $y-1$ terms they equal every integer from $0$ to $y-2$ we can see that the term that contains $x$ is $y$ (also from our inductive step). Since there are $n$ terms in total, we can see that the next $n - y$ terms must occupy every integer from $y+1$ to $n$. We can thus compute that the total number of $1$'s would be $\frac{(y-1)(y-2)}{2} + \frac{(n+y)(n-y+1)}{2}$. Simplifying this we can see that this is equal to $\binom{n}{2} + 1$. However, we know that the total number of $1$'s is $\binom{n}{2}$. Contradiction. $\blacksquare$
13.08.2023 08:37
holy this took me 3 hours, imo should be placed in c3 lol The key is to compare partial sums $s_i=a_{i+1}+\dots+a_{i+n}$. The condition implies $s_0<s_n<\dots<s_{n^2}$; in particular, since these values range from 0 to n, and there are n+1 groups, each group corresponds s.t. $s_{kn}=k$ (rigid!). We proceed by induction to show that there is one unique sequence, namely the sequence starting with the first n numbers 0, then the next string of n numbers having n-1 0s, with the last number being a 1, etc. by increasing the number of 1s that end in a string with length n. It's easy to check that this works. The base case n=1 is easily verified because the condition only needs to hold for i=0, meaning $a_1<a_2$ so it's just $0,1$ unique. Then take the smallest i s.t. $a_i=1$ (rigid!), along with $s_n=1$ implying $n+1\le i\le 2n$. Also, noting that the value of i makes $s_{i-n}$ contain $a_i$, meaning it's at least 1, we get $$1\le s_{i-n}< s_i <\dots s_{i+(n-2)n}\le n\implies s_{i+nj} = j+2\implies\sum_{k=0}^{n} s_{nk} = \sum_{j=-1}^{n-2}s_{i+nj}$$since there are n choices and n values for $s_{i+nj}$; in particular, there cannot be any 1s in $(i+(n-2)n,n^2+n]$ (since otherwise the sums are nonequivalent), which implies, along with the fact that $s_{n^2}=n\implies a_x=1\forall n^2+1\le x\le n^2+n$, that we must have $i+(n-2)n=n^2\implies i=2n$ (otherwise there is a 1 in between). On the other hand, note that $s_{2n-1}$ contains $a_{2n}$ and another 1, since it has at least as many 1s as $s_{2n}=2$ minus 1 (if $a_{2n}$ were to equal 1). So we have the bound $$2\le s_{2n-1} < s_{3n-1} < \ldots < s_{n^2-1} \le n\implies 2=s_{2n-1}=s_{2n}\stackrel{a_{2n}=1}{\implies}a_{3n}=1;$$in the same manner inductively (next we would take $3=s_{3n-1}=s_{3n}\stackrel{a_{3n}=1}{\implies}a_{4n}=1$), we can get that $a_{ln}=1$. Now, we can erase $a_x\forall x\in\{1,2,...,n,2n,3n,...,n^2+n\}$, which doesn't effect the condition, so we are done, because this has reduced the problem by 2n, which is indeed $n^2+n-(n-1)^2-(n-1)=2n$ into the hypothesis $(n-1)^2$. We already know that the terms that we erased did satisfy our claimed sequence, whence nothing changes. $\blacksquare$ edit: in OTIS version it said $n\ge 1$, which is why i used base case n=1; probably n=2 shouldn't be too nontrivial though even though its SIX VARIABLES. also is it fine in contest if you extend domain given that there's no problems? im not sure if this is plausible someone pls answer
01.09.2023 04:10
Kinda involved bruh. Heres my sol. We claim there exists only one such sequence which is the sequence, \begin{align*} a_1=a_2=\dots=a_n &= 0\\ a_{n+1} = a_{n+2} = \dots = a_{2n-1}&=0 \ a_{2n}=1\\ a_{2n+1} = a_{2n+2} = \dots = a_{3n-2}&=0 \ a_{3n-1}=a_{3n}=1\\ &\vdots\\ a_{n^2-n+1} =0 \ a_{n^2-n +2} = \dots = a_{n^2-1} = a_{n^2}&=1\\ a_{n^2+1}=a_{n^2+2} = \dots = a_{n^2+n} &=1 \end{align*}It is clear that this sequence clearly satisfies the required condition since if $a_k,a_{k+1},\dots,a_{l} \in \{a_{i+1},\dots,a_{i+n}\}$ are 1s for $0\leq i \leq n^2-n$, then so are $a_{k+n},a_{k+1+n},\dots,a_{l+n}$ an in addition so is $a_{k+n-1}$ confirming the strict inequality. We shall then show that this is the only sequence which satisfies the given conditions. We have the following key claim. Claim : Consider the range $a_{(k-1)n+1},\dots,a_{kn}$. There exists no terms $a_i=1$ such that $i<kn-k+2$. Proof : Consider the above range. By way of contradiction, assume that there exists some $i<kn-k+2$ such that $a_i=1$. Let $m$ be the minimum such index. Let $m=kn-n+p$ ($p<n-k+2$). First, we have the chain of inequalities \[a_1+\dots+a_n < a_{n+1}+\dots + a_{2n} < \dots < a_{n^2}+\dots + a_{n^2+n}\]This means that since we only have 0s and 1s as terms, $a_(k-1)n+1+ \dots a_{kn} = k-1$ for all $1 \leq k \leq n+1$. First, note that since $m$ is the minimum such index, and $m<kn-k+2$, \[a_{m-n+1} + \dots + a_{m-1} + a_m = (k-2)+a_{(k-1)n+1}+\dots + a_m = k-1\]Then, we have the following chain of inequalities, \begin{align*} k-1 = a_{m-n+1} + \dots + a_{m-1} + a_m &< a_{m+1}+\dots + a_{kn} + a_{kn+1} + \dots + a_{m+n}\\ &< a_{m+n+1} + \dots + a_{(k+1)n} + a_{(k+1)n +1} + \dots + a_{m+2n}\\ &\vdots\\ &< a_{n(n-k)+m+1} + \dots + a_{n^2} + a_{n^2+1} + \dots + a_{n(n-k+1)+m} \end{align*}Note that since these are strict inequalities the value of each sum must be atleast 1 more than the previous (this is what we use below). Now, we require $a_{m+1}+\dots + a_{kn} = k-2$ as $a_{(k-1)n+1} + \dots + a_{m+1}+\dots + a_{kn}=k-1$. This then gives us that \[a_{kn+1} + \dots + a_{m+n} > 2\]Since the sum $a_{kn+1} + \dots + a_{(k+1)n}=k$ again this gives \[a_{m+n+1} + \dots + a_{(k+1)n} < k-2\]Again using the sum of $a_{(k+1)n+1}+\dots + a_{(k+2)n} = k+1$ we must have \[ a_{(k+1)n +1} + \dots + a_{m+2n} > 3\]we then continue likewise. If it is indeed possible to have $a_m=1$, then there must exist possible values for all $a_i$ when $a_m=1$. Thus, this continues until the last bath of terms, giving us that \[a_{n^2} + a_{n^2+1} + \dots + a_{n(n-k+1)+m} > n-k+2\]But, note that since $m=kn-n+p$, we also have \[a_{n^2} + a_{n^2+1} + \dots + a_{n(n-k+1)+m} < 1(m-nk+n)+1 = kn -n + p -nk + n +1 = p+1 \leq n-k+2\]which is a clear contradiction to the previous inequality. Thus, clear there cannot exist such $c$. Now, by the nature of the claim it is clear that indeed the above described sequence is the only one which works.
02.05.2024 06:49
We claim the only sequence which works is analogous to the following example for $n=4$: \[0000~0001~0011~0111~1111.\] Define a $(k)$ block as a block of $n$ consecutive terms starting with $a_j$, where $j \equiv k \pmod n$. Notice the $n+1$ $(1)$ blocks are fixed up to permutation, as the minimum possible sum is 0 and the maximum is $n$. It follows that all $(k)$ blocks are also fixed up to permutation. Since the first/last $(1)$ blocks must be all 0s/1s, the total sum of all $(k)$ blocks, for each $2 \leq k \leq n$, will be $\tfrac{n(n+1)}{2} - (n-k)$, which can only be written as the sum of $n$ distinct integers between 0 and $n$, inclusive, as \[0+1+2+\ldots+(n-k-1)+(n-k+1)+\ldots+n.\] Going from left to right, we can fix each term of the sequence by considering increments. $\blacksquare$
30.08.2024 20:36
Define a block starting at index $i$ to be refer to the $n$ consecutive elements of the sequence $a$ starting at $a_i$. We claim that the answer is only the sequence uniquely defined by the blocks starting at $ni + 1$ being $n - i$ 0s followed by $i$ 1s. Proof that this works: For each element $a_i$, if $a_i$ is $1$ then $a_{n + i}$ is also $1$, if $a_i$ is $0$ we only have $a_{n + i} = 1$ if $i = nj + n - j$. We see that for each element of the block, the corresponding element in the next block is at least the current element, and we are also guaranteed to have an element with index $(n -1)(j + 1) + 1$ in each block, since it's just things that are $1$ mod $n - 1$, so the inequality is strict. Proof of necessity: We induct, base case is trivial for $n = 1$. We see all the blocks of starting with $ni + 1$ have distinct sums, so they must be $0,1, \cdots n$ in that order, so each block of that form has $i$ 1s. We show each of these blocks must end with $1$. Call these block ending indices "good". Consider the first good index that is not a $1$ and is not index $n$. If the index is $kn$ for $k > 2$, we know the block starting with $(k - 1)n$ contains $1 + k - 1 = k$ 1s, and the block starting at $kn$ contains at most the number of 1s as the block starting with $kn + 1$, which is $k$, so the property cannot be satisfied. If $k = 2$, let the position of the unique $1$ in that block be $n + c$. Now we inductively prove that each block starting at $xn + c + 1$ has $x$ 1s, as well as all elements from $xn + n+c + 1$ to $xn + 2n$ being 0. The base case of $x = 0$ is obvious, then clearly if it is true for $x - 1$ we need at least $x$ 1s in the block $xn + c + 1$, we know cannot have anything positive from $xn + c + 1$ to $xn + n$, but for the sum to be at least $x$ we then need all 1s in the block starting at $xn + n + 1$ to be in the block starting at $xn + c + 1$, meaning that there is nothing in the range $xn + n + c + 1$ to $xn + 2n$, since all $x$ 1s were used up in the first $c$ elements of the block, which also forces the sum to be exactly $x$. Now at some point we end up with all the $1$s in the block starting at $ni + 1$ in the first $c$ elements of the block, but there is eventually going to be more than $c$ 1s in the block, contradiction. Thus no good indices can have a $0$. Now, we can remove the first $n$ elements. The property still must hold for the remaining indices, and note that each block contains exactly one good index, so we can just remove all good indices and the property should still hold for blocks of size $n - 1$. Since we are also left with $n^2 - n$ elements, we can just induct.
03.01.2025 17:31
I'm not sure of a more efficient method other than literally bashing... We claim that the only sequence that works is the one defined with $n+1$ "blocks" of $n$ numbers, with the $k$th block having $k-1$ $1$'s at its end. For, example, for $n=4$ it would be: $0000|0001|0011|0111|1111.$ Let $S_k = a_k+a_{k+1}+\cdots+a_{k+n-1}.$ Then $0 \leq S_1<S_{n+1}<\cdots < S_{n^2+1} \leq n \implies S_{mn+1}=m$ for $1 \leq m \leq n.$ Therefore there is a total of $S=n(n+1)/2$ $1$'s in the sequence. Meanwhile, for $0 \leq r < n, r \neq 1,$ we have that $0 \leq S_r < S_{r+n}<\cdots < S_{r+n(n-1)} \leq n,$ so this list is the list $0, 1, 2, \dots, n$ but with one of these numbers not appearing. However, note that their sum is $S,$ hence because $S_{r+n(n-1)}$ goes up to index $a_{r+n^2-1},$ there are still $n^2+n-(r+n^2-1) = n-r+1$ $1$'s at the end (since $S_{n^2+1}=n$). Therefore, $S_r, S_{r+n}, \cdots$ is the list $0, 1, 2, \cdots, n$ but with $n-r+1$ missing. Then, it is easy to show from a process-like argument that $S_i$ is a sequence with $n$ $1$'s, then $n-1$ $2$'s, $n-1$ $3$'s, etc. until $n-1$ $n$'s, and finally one $n=S_{n^2+1}.$ Now, we have the recurrence $a_k=(S_{k-n+1}-S_{k-n})+a_{k-n},$ so the increment depends on the difference between consecutive $S_k$s. Then, going through the sequence manually would finish. QED
01.02.2025 00:07
The only such sequence is that satisfying $a_i = 1$ if $kn - k+2 <= i <= kn$ for some $1 \le k \le n+1$ and $a_i = 0$ otherwise. For concreteness, we provide the sequence for $n = 5$ below; splitting the sequence into "chunks" will make the construction more clear: $$0,0,0,0,0|0,0,0,0,1|0,0,0,1,1|0,0,1,1,1|0,1,1,1,1|1,1,1,1,1.$$One can check (say by making a table) that this works. It suffices to show that there is at most one sequence satisfying the desired property. Consider the sums $$a_1 + \dots + a_n < a_{n+1} + \dots + a_{2n} < \dots < a_{n^2+1} + \dots + a_{n^2 + n}.$$These sums hence take on $n+1$ distinct values, but there are only $n+1$ possible values for each sum, those being the integers between $0$ and $n$ inclusive. Hence $a_1 + \dots + a_n = 0$ and $a_{n^2+1} + \dots + a_{n^2+n} = n.$ As such, $a_i = 0$ for $1 \le i \le n$ and $a_i = 1$ for $n^2 + 1 \le i \le n^2 + n.$ Additionally, we see that each sum counts the number of ones in the sum, so there are a total of $0 + 1 + \dots + n = \frac{n^2+n}{2}$ ones. For any $2 \le k \le n,$ we can say something similar about the sums $$a_k + \dots + a_{k+n-1} < a_{k+n} + \dots + a_{k+2n-1} < \dots < a_{k+n^2-n} + \dots + a_{k+n^2-1}.$$These sums take on distinct integers between $0$ and $n,$ inclusive. For brevity, let $s_i = a_i + \dots + a_{n+i-1}.$ Then $$s_k + s_{k+n} + \dots + s_{k+n^2-n} = \frac{n^2+n}{2} - (n-k+1).$$Given that the $s_{k+mn}$ are integers in strictly increasing order, this implies that there is exactly one way to assign values to each of the $s_{k+mn}$. As such, this implies that for all $i,$ we have that $s_i$ is always equal to a fixed value. From this, since $s_1 = 0$ implies $a_i = 0$ for $1 \le i \le n,$ we uniquely determine the sequence $a_i.$ Since the sequence we claimed at the beginning works, we are done.