2
  1. Find the permutation $(a_1,\cdots, a_n)$ of $\{1,\cdots, n\}$ that maximizes the value $\sum_{i=1}^n a_i a_{i+1},$ where $a_{n+1} = a_1.$
  2. Find the permutation $(a_1,\cdots, a_n)$ of $\{1,\cdots, n\}$ that minimizes the value $\sum_{i=1}^n a_i a_{i+1},$ where $a_{n+1} = a_1.$

Let $S(A) = \sum_{i=1}^n a_i a_{i+1}$ for a permutation $A = (a_1,\cdots, a_n)$ of $\{1,\cdots, n\}$.

To find the two permutations, I think it would be useful to consider the effect of swapping elements $i$ and $j, 1\leq i < j \leq n$ on the result of the sum. Assume $A_{max}$ maximizes $S(A_{max})$. Note that since the function $S$ on permutations is invariant under cyclic shifts, we may assume WLOG that $a_1 = 1$. Then we need to figure out what $a_2$ can be. Note that the difference $A_{max} - A'$, where $A'$ results from switching positions $i$ and $j$ in $A_{max}$ equals $a_{i-1} a_i + a_i a_{i+1} + a_{j-1} a_{j} + a_j a_{j+1} - (a_{i-1} a_j + a_j a_{i+1} + a_{j-1} a_i + a_i a_{j+1})$, where indices are interpreted modulo $n$ (e.g. $a_{-1} = a_n, a_{n+1} = a_1,$ etc.). One could factor the change as $-(a_i - a_j) (a_{j+1} - a_{i-1} - (a_{i+1} - a_{j-1})),$ but I'm not sure how to proceed further.

Gord452
  • 1,127

1 Answers1

1

Nice question! It turns out this is known. It was B-3 in the 1996 Putnam Competition.

The maximum value is $4n-6$ and the minimum value is $(n^3-4n)/3+\epsilon,$ where $\epsilon=2$ if $n$ is even and $\epsilon=1$ if $n$ is odd.

The maximum occurs when the permutation is $$ (1,n- 1,3,n-3,...,n-4,4,n-2,2,n) $$ and the minimum occurs when it is $$ (1, 3, 5,\ldots, 2\lceil n/2\rceil -1, 2\lfloor n/2\rfloor,\ldots, 6, 4, 2), $$ See The Smoothest and Roughest Permutations by Vasile Mihai and Michael Woltermann The American Mathematical Monthly, 108(3):272-273, 2002, available here

See also sequence A110610 in the Online Encyclopeadia of Integer Sequences.

kodlu
  • 9,338
  • 1
    Nice. I also remember 1996 Putnam B-3. I applied it in this question: https://math.stackexchange.com/questions/2620377/does-sum-i-1n-a-i1-52-sum-i-1n-a-i-sum-i-1n-a-i-a-i1/3273630#3273630 – River Li Aug 22 '22 at 22:57