A087035 Maximum value taken on by f(P) = Sum_{i=1..n} p(i)*p(n+1-i) as {p(1),p(2),...,p(n)} ranges over all permutations P of {1,2,3,...,n}.
0, 1, 4, 13, 28, 53, 88, 137, 200, 281, 380, 501, 644, 813, 1008, 1233, 1488, 1777, 2100, 2461, 2860, 3301, 3784, 4313, 4888, 5513, 6188, 6917, 7700, 8541, 9440, 10401, 11424, 12513, 13668, 14893, 16188, 17557, 19000, 20521, 22120, 23801, 25564, 27413, 29348
Offset: 0
Examples
a(3)=13, since f takes on the values 10 and 13: f({1,2,3})=10, f({1,3,2})=13, f({2,1,3})=13, f({2,3,1})=13, f({3,1,2})=13 and f({3,2,1})=10.
Links
- Index entries for linear recurrences with constant coefficients, signature (3,-2,-2,3,-1).
Programs
-
Mathematica
t = Compile[{{n, _Integer}}, Module[{s = 0}, (Do[If[Max[w, x, y] - Min[w, x, y] >= 2 Abs[w - x], s = s + 1], {w, 0, n}, {x, 0, n}, {y, 0, n}]; s)]]; m = Map[t[#] &, Range[0, 45]]
Formula
From Clark Kimberling, Jun 10 2012: (Start)
a(n) = 3*a(n-1)-2*a(n-2)-2*a(n-3)+3*a(n-4)-a(n-5).
G.f.: (x + x^2 + 3*x^3 - x^4)/(((1 - x)^4)*(1 + x)).
a(n+1) + A213045(n) = (n+1)^3. (End)
a(n) = (2*(n-1)*(n+1)*(2*n+3)-3*(-1)^n+9)/12. - Bruno Berselli, Jun 11 2012
Extensions
a(11) and a(12) from R. J. Mathar, Jun 26 2012
Merged with a sequence of Clark Kimberling by Max Alekseyev, Jun 27 2012
a(0)=0 prepended by Alois P. Heinz, Aug 24 2024
Comments