This is a homework question which we are really struggling with:
We'll define the distance between sequences $(a_i)_{i=1}^n,(b_i)_{i=1}^n$ by: $$\text{dist}\left((a_i)_{i=1}^n,(b_i)_{i=1}^n\right)=\sum _{i=1}^n \left|a_i-b_i\right|$$
Let $(a_i)_{i=1}^n$ a sequence of positive integers $a_i\in\{1,\dots,n^5\}$. We need to find a strictly increasing sequence of integers $(b_i)_{i=1}^n$ such that $\text{dist}\left((a_i)_{i=1}^n,(b_i)_{i=1}^n\right)$ is minimal ($b_i$ can be negative).
I.e., an approximating sequence for the sequence $(8,2,4)$ is $(2,3,4)$ and the distance is $7$.
We thought of finding this sequence in an iterative fashion: First, taking the average $A$ (rounded) and placing it in the middle of $ \ b_n$ and completing it like this: $$b_n=A-\left\lfloor\frac{n}{2}\right\rfloor,A-\left\lfloor\frac{n}{2}\right\rfloor+1,\dots,A-1,A,A+1\dots,A+\left\lfloor\frac{n}{2}\right\rfloor$$
Next, trying to improve the approximation of $ \ b_n$ while keeping the monotonicity property until we reach our destination. We need to give a polynomial-time algorithm so anything that's not exponential is OK. There is a $\mathcal{O}(n\lg n)$ algorithm for this problem.
However, we found it complicated to phrase the iterative step of improving (let alone computing it!).
Also, given that $(a_i)_{i=1}^n$ is indeed approximating $(b_i)_{i=1}^n$, I don't know how to formally prove it (that there doesn't exists another sequence that the distance from it to $a_n$ is smaller).
I think it's an interesting question (yet, we found it challenging) and I'll appreciate any help with it.
ADDITION: After thinking more about it, I don't think there's a need to compute the average because starting with, i.e., this sequence: $$a_1, a_1+1, a_1+2, \dots, a_1+n-1$$ is essentially the same since the direction I'm trying to think about is iterating over and over over the result.
How about starting with the longest increasing subsequence, assume we found such subsequence of length $k$. Now we have to "take care" of $n-k$ holes. I can do it with pen and paper using an intuitive heuristics but I can't think of an algorithm to do it.