Given a permutation of size N, you can create a distance matrix that shows the distance between each element to each other element, giving a complete description of the permutation. ie 1,2,3,4 creates \begin{array}{|c|c|c|c|c|} \hline & \textbf{1} & \textbf{2} & \textbf{3} & \textbf{4} \\ \hline \textbf{1} & 0 & 1 & 2 & 3 \\ \hline \textbf{2} & * & 0 & 1 & 2 \\ \hline \textbf{3} & * & * & 0 & 1 \\ \hline \textbf{4} & * & * & * & 0 \\ \hline \end{array} The bold table entries show elements and the body entries are distances between the row and column elements for that cell.
The distance matrix will always have a 0 diagonal and be symmetric, so for the diagonal and symmetric elements will be omitted.
The permutation 1,3,4,2 generates: \begin{array}{|c|c|c|c|} \hline & \textbf{2} & \textbf{3} & \textbf{4} \\ \hline \textbf{1} & 3 & 1 & 2 \\ \hline \textbf{2} & & 2 & 1 \\ \hline \textbf{3} & & & 1 \\ \hline \end{array}
The absolute difference of the two distance matrices is: \begin{array}{|c|c|c|c|} \hline & \textbf{2} & \textbf{3} & \textbf{4} \\ \hline \textbf{1} & 2 & 1 & 1 \\ \hline \textbf{2} & & 1 & 1 \\ \hline \textbf{3} & & & 0 \\ \hline \end{array}
The sum of this difference matrix is 6 (D). The sequence 2,3,1,4 gives a maximum value of D=8 for a permutation of N=4 length.
Given the size of a permutation N, is it possible to find an expression for the maximum possible difference matrix sum? That is D(N)?
I tried some brute force computation methods for this but it becomes very slow once going past around 12 or 13, and hits the memory limits of 32 bit array indexing.
Can someone recommend places to look for leads on this or more specific terms for the problem? I'm not very familiar with math lingo.