<s>[INST] What is the biggest possible sum $|X_1-X_2|+|X_2-X_3|+\cdots+|X_{n-1}-X_n|$ where $X_1,X_2,\cdots,X_n$ are first $n$ positive integers? What is the biggest possible sum $|X_{1}-X_{2}|+|X_{2}-X_{3}|+\cdots+|X_{n-1}-X_{n}|$ where $X_{1},X_{2},\cdots,X_{n}$ are first $n$ positive integers?
 [/INST] Be greedy.  $n$ should go next to $1,2$, then $n-1$ next to $1$ and so on.  There are other arrangements that give the same sum, but none better.  For $n=12$ it gives $7,5,9,3,11,1,12,2,10,4,8,6$ for $2+4+6+8+10+11+10+8+6+4+2$ and for $n=13$ it gives $8,5,10,3,12,1,13,2,11,4,9,6,7$ for $3+5+7+9+11+12+11+9+7+5+3+1$  The patterns in the elements of the sums should be clear.
</s>