A102417 In the lexicographically ordered table of permutations of [n], there are two entries that give the greatest sum of pairwise products and they are reversals of each other. The items in this sequence are the indices of the earlier of the two.
0, 1, 3, 11, 41, 191, 1055, 6959, 53159, 462239, 4499999, 48454559, 571409999, 7321386239, 101249648639, 1502852279039, 23827244757119, 401839065331199, 7182224591270400, 135607710526041600, 2696935204633823744
Offset: 2
Examples
The 6959th entry in the table of permutations of order 9 is {1, 3, 5, 7, 9, 8, 6, 4, 2}, which has the pairwise products 3 15 35 63 72 48 24 8; these sum to 268 and this is the ninth entry in A101986, so a(9) = 6959.
Formula
a(n) = Sum_{k=1..n} (n+1-k)*d2(k) where d2(k) = k! if k is odd, k! - (k/2)! otherwise [with thanks to Max Alekseyev].
Comments