Suppose that a sequence $(a_n)_{n=1}^{\infty}$ of integers has the following property: For all $n$ large enough (i.e. $n \ge N$ for some $N$ ), $a_n$ equals the number of indices $i$, $1 \le i < n$, such that $a_i + i \ge n$. Find the maximum possible number of integers which occur infinitely many times in the sequence.
Problem
Source:
Tags: number theory unsolved, number theory
10.11.2010 02:43
does any body have a perfect solution for this problem?
08.11.2011 21:29
Does anybody have solution for this problem?
25.09.2014 08:15
Any full solution for this problem?
13.10.2018 02:44
After such a long time, here is the solution to this beautiful problem. We proceed as follows. First, define the set, $S_n$ via $$ S_n=\{i:1\leq i<n,a_i+i\geq n\}. $$Then, $a_n=|S_n|$. We first claim that, the sequence $a_n$ is bounded. To prove this, let, $M=\max\{a_1,a_2,\dots,a_N\}$. Note that, $a_{N+1}=|\{i:1\leq i\leq N, a_i+i\geq N+1\}|$. Observe that, if $i_0\notin S_N$, then, $a_{i_0}+i_0<N$, hence, $i_0\notin S_{N+1}$. Hence, $|S_{N+1}|\leq |S_N|+1$. Now, if $a_N\leq M-1$, there is nothing to prove. Hence, assume that, $a_N=M$. In particular, since $N-1\geq a_N=M$, we have $M=N-d$, for some $d$. In particular, we get, $a_i\leq N-d$, for every $i\in\{1,2,\dots,N-1\}$. Now, observe that, for every $i=1,2,\dots,d-1$, $a_i+i\leq a_i+d-1\leq N-d+d-1<N$, hence, $i\notin S_N$. Hence, the only members of $S_N$ can be among $i=d,d+1,\dots,N-1$. Since $d=N-M$, and since $|S_N|=M$, we have that $\{d,d+1,\dots,N-1\}=S_N$. Hence, $a_{N-M}+(N-M)\geq N\implies a_{N-M}\geq M$. Combining this with $a_{N-M}\leq M$, we have, $a_{N-M}=M$. Hence, $N-M\notin S_{N+1}$, and therefore, $|S_{N+1}|\leq |S_N|=M$. Using this ideas, the sequence is bounded. Next claim is that, the sequence is periodic. To prove this, we will rely on the fact that, $a_n\leq M$ for every $n$. Observe that, for any $\ell$ sufficiently large, $a_{\ell}$ depends only on the indices, $i=\ell-1,\ell-2,\dots,\ell-M$. Indeed, consider an $i\leq \ell-M-1$. We have, $a_i+i\leq \ell-M-1+M=\ell-1<\ell$, hence, $i\notin S_\ell$. Hence, the only indices matter are those. In particular, consider $M^M$ blocks of terms, that is, (note that, $i=n-1\implies a_i+i\geq n$ by induction, hence, $S_n\neq \varnothing$) $B_1,B_2,\dots,B_{M^M}$ where, each block consists of $M-$terms of the sequences. The next block of terms, by the Pigeonhole principle, must be one of $B_i$, and from there onwards, the sequence is periodic. Now, suppose that, the sequence is periodic after $L$, and let us redefine $M$ with $M=\max\{a_i:i\leq L\}$. Now, take an $i_0$ such that $a_{i_0}=M$. We have, $i_0-M,i_0-M+1,\dots,i_0-1\in S_{i_0}$. Hence, $a_{i_0-M}+(i_0-M)\geq i_0\implies a_{i_0-M}\geq M$. However, $M\geq a_{i_0-M}$ also holds, giving us $a_{i_0-M}=M$, if $a_{i_0}=M$. Hence, if $a_n=M$, then we have, $a_{n+M}=M$. Finally, we will show that, this sequence, from some point onwards, can only take the values $M$ and $M-1$. For the sake of contradiction, assume that there is a term in the sequence that is less than $M-1$. Now, consider a pair $(k,n)$ with $a_n=M$, and $a_k<M-1$ with the smallest $k-n$ (note that, by definition, such a pair must exist). We have, $a_k<M-1$. Now, we claim that $a_{k-1}<M$. Suppose that, $a_{k-1}=M$. From the previous paragraph, we have $a_{k+M-1}=M$. However, $a_{k+M-1}$ depends on the terms, $a_{k+M-2},\dots,a_{k-1}$. Hence, $k\in S_{k+M-1}$. However, $a_k+k<M+k-1$, hence, $k\notin S_{k+M-1}$, contradiction. Therefore, $a_{k-1}<M$ and $a_k<M-1$. We now inspect $a_{k+M-1}$. Note that, $a_{k+M-1}$ depends on $a_{k+M-2},\dots,a_{k-1}$. Now, $a_{k-1}+k-1<M+k-1$, hence, $k-1\notin S_{k+M-1}$. Furthermore, $a_k+k<M-1+k$, hence, $k\notin S_{k+M-1}$. Therefore, $a_{k+M-1}\leq M-2<M-1$. However, this gives, $a_{k+M-1}<M-1$, and $a_{n+M}=M$, and for this pair, $k+M-1-(n+M)=k-n-1<k-n$, contradicting with the earlier choice. We are done. Therefore, the sequence can take at most two distinct values infinitely often. Finally, we will construct an example. Take, $a_1=\cdots=a_{N-3}=0$, $a_{N-2}=2$, and $a_{N-1}=1$. $a_N=2$, $a_{N+1}=1$, $a_{N+2}=2$, and so on; thus this sequence has the desired claim.
22.12.2021 22:09
A different solution (along with motivation): The answer is $\boxed{2}$. Construction is just $2,1,2,1,2,1,\ldots$. Next we prove the other direction. Let $S$ be the set of all integers occurring infinitely many times. Claim 1: The sequence is bounded. Proof: Note that all terms of the sequence are $\le \max(a_1,a_2,\ldots,a_{N-1})$ (by induction), as was also shown above. $\square$ This also gives $S$ is finite. Let $x = \min S$ and $y = \max S$. Claim 2: For large $n$, $a_n \in S$. Proof: For any term not in $S$, there must be some point after which it doesn't occur. Since the sequence can contain only finitely many terms (by Claim 1), so by looking at each individual term, our claim follows. $\square$ Claim 3: For large $n$, if $a_n = x$, then $a_{n - x - 1} = x$. Proof: As $a_i \in S ~ \forall ~ n-x-1 \le i \le x$ (by Claim 2), so $a_i + i \ge n ~ \forall ~ i \le x$. This means $a_{n-x-1} + (n-x-1) < n$. But since $a_{n-x-1} \ge x$, so this forces $a_{n- x - 1} = x$. $\square$ Claim 4: For large $n$, if $a_n = y$, then $a_n - y = y$. Proof: Note that $a_i + i < n ~ \forall ~ i \le n - y - 1$ (by Claim 2), so this forces $a_i + i \ge n ~ \forall ~ i \ge n - y$. Thus $a_{n-y} + (n-y) \ge n$. But since $a_{n-y} \in S$ (by Claim 2), so $a_{n-y} \le y$, forcing $a_{n-y} = y$. $\square$ Claim 5: Let $d = \gcd(x+1,y)$. $\exists ~ i< j$ such that $a_i = x, a_j = y$ and $j - i \le d-1$. Proof: Pick any large $i_0, j_0$ with $i_0 < j_0$ such that $a_{i_0} = y$ and $a_{j_0} = x$. By Claim 3, we have $a_{j_0 - x - 1} = x$, etc. So we can choose $j_0$ such that $j_0 - i_0 \le x+1$. By Bezout's Lemma, we can choose $r,s \in \mathbb Z_{>0}$ such that $$r \cdot (x+1) - s \cdot y = d$$Whenever $i_0 < j_0$, we change $$(i_0,j_0) \to (i_0 - s \cdot y, j_0 - r \cdot (x+1))$$while preserving $a_{i_0} = y$ and $a_{j_0} = x$ (by Claims 3,4). As this decreases $j_0 - i_0$, so this must end at some point. But at that point, $j_0 - i_0 \le d-1$, so we are done (one thing to note that $i_0,j_0$ can never become equal). $\square$ Now observe that for $n \ge N$ we have $$a_{n+1} \le a_n + 1$$Now pick any such $i,j$ satisfying properties in Claim 5. It follows that $$y - x = a_j - a_i \le j - i \le d-1$$Now if $|S| \ge 3$, then $y > x+1$. In particular $d = \gcd(x+1,y) \le y - (x+1)$, which is a contradiction. Hence $\boxed{|S| \le 2}$, which completes the proof of the problem. $\blacksquare$