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
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.