OFFSET
0,4
COMMENTS
MAPLE
F := proc(S) local i, j, M;
M := 0;
for j from 1 to nops(S) do
for i from 1 to j-1 do
M := M + (abs(i - j) - abs(S[i] - S[j]))^2
od:
od: M end:
a := proc(n) local P, m, u, mm;
P := combinat:-permute(n);
m := 0;
for u in P do
mm := F(u);
if mm > m then m := mm fi;
od: m end:
PROG
(PARI) a375623(n) = my(m=0); forperm(n, p, m=max(m, sum(i=1, n, sum(j=1, i-1, (abs(i-j)-abs(p[i]-p[j]))^2)))); m \\ Hugo Pfoertner, Aug 22 2024
CROSSREFS
KEYWORD
nonn,more
AUTHOR
W. Edwin Clark, Aug 21 2024
EXTENSIONS
a(11)-a(13) from Hugo Pfoertner, Aug 23 2024
a(14) from Markus Sigg, Aug 25 2024
a(15) from Hugo Pfoertner, Sep 04 2024
STATUS
approved