# Solving $a_1+…+a_n=2011$ , $a_1\leq |a_2-a_3|, \ldots a_n\leq|a_1-a_2|$ with non-negative integers

Let $a_1,...,a_n$ non negative integers s.t. $a_1+...+a_n=2011$, where $n$ is a positive integer, $n\geq3$ and $a_1\leq |a_2-a_3|$, $a_2\leq|a_3-a_4|$,..., $a_n\leq|a_1-a_2|$.

This problem is similar to What can I say about the minimum and the maximum value of $n$?, only that here the $a_n$ are allowed to be zero.

I have an answer but I am not sure if it is right.

I have to take two cases: $a_3\leq a_2$ or $a_2\leq a_3$.

If $a_3\leq a_2\Rightarrow |a_2-a_3|=a_2-a_3\Rightarrow a_1\leq a_2-a_3\Rightarrow a_1\leq a_2\Rightarrow |a_1-a_2|=a_2-a_1\Rightarrow a_n\leq a_2\Rightarrow a_{n-1}\leq|a_n-a_1|\leq a_2\Rightarrow...\Rightarrow a_4\leq a_2\Rightarrow |a_3-a_4|\leq a_2.$

But $a_2\leq |a_3-a_4|$. Then $|a_1-a_2|=|a_3-a_4|=...=|a_n-a_1|=a_2$.

So $a_1=a_3=a_5=...=0$ and $a_2=a_4=a_6=...$.

Therefore $k\cdot a_2=2011\Rightarrow a_2=1$ and $k=2011$ $\Rightarrow n=4022$.

The other case is similar.

I don't want to post it but I am just curious!!! It is right my argument?

• I do not understand why this is so heavily qownvoted. It is a clear question for proof-verification, showing more effort than many other questions. So pointing out the error ("positive" vs "non-negative") as a comment or answer should be sufficient. – Martin R Feb 16 '18 at 20:11
• @Problemsolving: I have taken the liberty to edit your question, hoping to make it clearer. Please check the edit. – Martin R Feb 16 '18 at 20:20
• @Martin R $a_{n-1}\leq |a_n-a_1|\leq$ max{$a_n,a_1$}$\leq a_2$. – Problemsolving Feb 16 '18 at 20:48
• @Martin R 1,1,1...,1 is not solution. – Problemsolving Feb 16 '18 at 21:07
• @Problemsolving: You are right, that was nonsense. But a 0 can be followed by one or two 1s: "0, 1, 0, 1, 1, 0, 1, 0, 1, 1, ..." – Martin R Feb 16 '18 at 21:15

Then $|a_1-a_2|=|a_3-a_4|=...=|a_n-a_1|=a_2$.
is not correct, as can be seen by considering the sequence $$1, 1, 0, 1, 0, \ldots 1, 0$$ but I think you were close.
Let $$x = \max(a_1, \ldots, a_n)$$ The $a_i$ cannot all be equal, so (by rotating the indices if necessary) we can assume that $a_1 = x$ and $a_n \ne x$.
If $a_2 \le a_3$ then $$x = a_1 \le a_3 - a_2 \le x \Longrightarrow a_2 = 0, a_3 = x \, .$$ Otherwise $$x = a_1 \le a_2 - a_3 \le x \Longrightarrow a_2 = x, a_3 = 0$$ which implies $$x = a_2 \le |a_3 - a_4| = a_4 \le x \Longrightarrow a_4 = x \, .$$ So the sequence starts either with $$x, 0, x, \ldots$$ or with $$x, x, 0, x, \ldots$$ Now the same argument can be repeated with $a_3=x$ or $a_4=x$, respectively, and one sees that the entire sequence consists of the “building blocks” $$x, 0 \quad \text{and} \quad x, x, 0$$ which can be arbitrarily combined. Finally, since the sum of all elements is $2011$ (which is a prime number), we necessarily have $x = 1$.
Therefore the solutions are exactly the sequences made of the building blocks $$1, 0 \quad \text{and} \quad 1, 1, 0$$ with a total number of $2011$ one's (and rotations thereof).