a.
Let x1,x2,…,xn be non-negative integers satisfying the conditions from the statement. We put M=max1≤i≤nxi. If xj=M then
x1x2+x2x3+⋯+xn−1xn≤x1xj+x2xj+⋯+xj−1xj+xjxj+1+xjxj+2+⋯+xjxn=xj(2011−xj)=M(2011−M)≤1005⋅1006.
Indeed, the last inequality comes to (M−1005)(M−1006)≥0 which is true for any integer M. The largest possible value is 1005⋅1006 because this value can be obtained by choosing, for example, x1=1005, x2=1006 and xk=0 for k≥3.
b.
For n=2 we have x1x2=1005⋅1006⇔x1(2011−x1)=1005⋅1006⇔(x1−1005)(x1+1006)=0⇔(x1,x2)∈{(1005,1006),(1006,1005)}.
For n=3, x1x2+x2x3=1005⋅1006⇔x2(x1+x3)=1005⋅1006 comes, as above, to x2=1005, x1+x3=1006 or x2=1006, x1+x3=1005. We obtain (x1,x2,x3)∈{(k,1005,1006−k)∣k=0,1,…,1006}∪{(k,1006,1005−k)∣k=0,1,…,1005}.
For n≥4, we denote by j the smallest index for which xj>0. Then, replacing xj by 0 and xj+2 by xj+2+xj, increases the value of the sum by xjxj+3. Using this remark it is easy to see that if x1x2+x2x3+⋯+xn−1xn=1005⋅1006, then at most three of the terms can be non-zero. We obtain (x1,…,xn)∈{(0,…,0,k,1005,1006−k,0,…,0)∣k=0,1,…,1006}∪{(0,…,0,k,1006,1005−k,0,…,0)∣k=0,1,…,1005}, where the group of the three non-zero components can be located anywhere.