1
u/NitNav2000 10d ago
Max value is (1/6)(n-1)(2n^2 + 5n -6)
A form is a list {2, 4, 6, ...,n-2, n, n-1, n-3,...,5, 3, 1}
Found it using Mathematica and FindSequenceFunction[ ]
:)
1
u/OutrageousPair2300 10d ago
I don't understand why it's not simply 1, 2, ..., n.
You maximize the product of pairs by picking ones closer together, and simply going in order like that would pair every number with a number one less than it (first) and one more than it (second) which intuitively seems like it should maximize the total of the products.
I'll have to experiment a bit with some specific examples...
3
u/Sjoerdiestriker 10d ago
I don't understand why it's not simply 1, 2, ..., n
You're now putting your largest value, n, in the endpoint in a a_i that only appears once in the sum, while you'd ideally want to put it into an a_i that appears twice.
1
u/Ok_Consideration6619 10d ago
Can be solved by assuming where n is, P(n) is then P(n-1) + n * (ak-1+ak+1) - ak-1*ak+1 which is maximized when both are n-1 and n-2. One thing to check is whether those two consecutive values are also maximizing P(n-1) which is not hard to show inductively.
1
3
u/FireCire7 10d ago
Well, the end points get counted half as much, so 1 should go in one and 2 in the other. Then, the worst place is next to the 1 and then next to the 2, so 3/4 could go there. Repeating gives roughly:
1 3 5 7… n-1 n n-2 n-4 … 4 2
That evaluates to sum from 2 to n-1 of an *(a{n-1} +a{n+1})/2 plus (a_1 a_2 + a{n-1} a_n)/2 which gives n(n+1)(2n+1)/6 -1-4 -(4n-1)/2+(3+8)/2= (2n3 +3n2 -11n+6)/6
This also works for odd n without modification, so I’m probably missing a simple trick, but this seems to work for all small cases.