Optimizing a problem which uses permutations

the problem tries to maximise the function F(perm(A1,A2,A3,…))
here’s my solution:
any help would be appreciated

Let M be the minimum number in the permutation.
What is answer when M is the first number in permutation?
What happens when M is at any other position? Hint: x \pmod y \lt y

1 Like