%I #61 Dec 20 2023 10:43:10
%S 0,2,9,23,46,80,127,189,268,366,485,627,794,988,1211,1465,1752,2074,
%T 2433,2831,3270,3752,4279,4853,5476,6150,6877,7659,8498,9396,10355,
%U 11377,12464,13618,14841,16135,17502,18944,20463,22061,23740,25502
%N Maximum sum of products of successive pairs in a permutation of order n+1.
%C 1 3 5 4 2 is the 11th permutation, in lexical order. of order 5. Its reverse 2 4 5 3 1 is the 41st. The earliest permutation of order 6 is the 41st, 1 3 5 6 4 2. This pattern continues as far as I have looked, so its reversal 2 4 6 5 3 1 is the 191st and the earliest permutation of order 7 is the 191st, et cetera.
%C Comments from _Dmitry Kamenetsky_, Dec 15 2006: (Start)
%C This sequence is related to A026035, except here we take the maximum sum of products of successive pairs. Here is a method for generating such permutations. Start with two lists, the first has numbers 1 to n, while the second is empty.
%C Repeat the following operations until the first list is empty: 1. Move the smallest number of the first list to the leftmost available position in the second list. The move operation removes the original number from the first list. 2. Move the smallest number of the first list to the rightmost available position in the second list. For example when n=8, the permutation is 1, 3, 5, 7, 8, 6, 4, 2. (End)
%C Convolution of odd numbers and integers greater than 1. - _Reinhard Zumkeller_, Mar 30 2012
%C For n>0, a(n) is row 2 of the convolution array A213751. - _Clark Kimberling_, Jun 20 2012
%H Reinhard Zumkeller, <a href="/A101986/b101986.txt">Table of n, a(n) for n = 0..1000</a>
%H Leroy Quet, <a href="http://list.seqfan.eu/pipermail/seqfan/2005-January/004759.html">Max/Min Sums From Permutations</a> - a message on Jan 28 2005 to the sequence list, asking for someone to provide more values and to submit these to OEIS.
%H <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (4,-6,4,-1).
%F a(n) = n*(2*n^2 + 9*n + 1)/6.
%F a(n+1) = a(n) + A008865(n+2); a(n) = A160805(n) - 4. [_Reinhard Zumkeller_, May 26 2009]
%F G.f.: x*(1+x)*(2-x)/(1-x)^4. - _L. Edson Jeffery_, Jan 17 2012
%F a(n) = 4*a(n-1)-6*a(n-2)+4*a(n-3)-a(n-4) for n>3, a(0)=0, a(1)=2, a(2)=9, a(3)=23. - _L. Edson Jeffery_, Jan 17 2012
%F a(n) = A000330(n) + A005449(n) - A000217(n). - _Richard R. Forberg_, Aug 07 2013
%F a(n) = 1 + sum( A008865(i), i=1..n+1 ). [_Bruno Berselli_, Jan 13 2015]
%F a(n) = A000290(n) + A000330(n). - _J. M. Bergot_, Apr 26 2018
%e The permutations of order 5 with maximum sum of products is 1 3 5 4 2 and its reverse, since (1*3)+(3*5)+(5*4)+(4*2) is 46. All others are empirically less than 46. So a(4) = 46.
%p a:=n->add((n+j^2),j=1..n): seq(a(n),n=0..41); # _Zerinvary Lajos_, Jul 27 2006
%t Table[(n + 9 n^2 + 2 n^3)/6, {n, 0, 41}] (* _Robert G. Wilson v_, Feb 04 2005 *)
%o (J) 0 1 9 2 & p. % 6 & p. (A) NB. the polynomial P such that P(n) is a(n).
%o NB. where 0 1 9 2 are the coefficients in ascending order of the numerator of a rational polynomial and 6 is the (constant) coefficient of its denominator. J's primitive function p. produces a polynomial with these coefficients. Division is indicated by % . Thus the J expression (A) is equivalent to the formula above.
%o (PARI) a(n)=n*(2*n^2+9*n+1)/6 \\ _Charles R Greathouse IV_, Jan 17 2012
%o (Haskell)
%o a101986 n = sum $ zipWith (*) [1,3..] (reverse [2..n+1])
%o -- _Reinhard Zumkeller_, Mar 30 2012
%Y Pairwise sums of A005581.
%Y Cf. A000290, A000330, A008865, A026035, A160805.
%K nonn,easy
%O 0,2
%A Eugene McDonnell (eemcd(AT)mac.com), Jan 29 2005
%E Edited by _Bruno Berselli_, Jan 13 2015
%E Name edited by _Alois P. Heinz_, Feb 02 2019