%I #25 Sep 08 2022 08:45:25
%S 1,5,11,20,35,57,85,120,165,221,287,364,455,561,681,816,969,1141,1331,
%T 1540,1771,2025,2301,2600,2925,3277,3655,4060,4495,4961,5457,5984,
%U 6545,7141,7771,8436,9139,9881,10661,11480,12341,13245,14191,15180,16215
%N Minimum over all permutations b of 1..n of sum b(i)*b^{-1}(i).
%C The maximum obtainable is A000330, the square pyramidal numbers. Problem suggested by _Leroy Quet_.
%H Vincenzo Librandi, <a href="/A118375/b118375.txt">Table of n, a(n) for n = 1..1000</a>
%H <a href="http://groups.google.com/group/sci.math/browse_thread/thread/6cf265b0d0e2f157">sci.math thread. </a>
%H <a href="/index/Rec">Index entries for linear recurrences with constant coefficients</a>, signature (4,-7,8,-7,4,-1).
%F a(n) = T(n) + e(n), where T(n) = n(n+1)(n+2)/6 = A000292(n) is the tetrahedral numbers and e(n) = 0 if n = 0,1 (mod 4) and 1 if n = 2,3 (mod 4). (Published by Rob Johnson in sci.math.)
%F G.f.: x*(1+2*x-x^2)*(1-x+x^2)/((1-x)^4*(1+x^2)). [Colin Barker, Apr 30 2012]
%F a(n) = 4*a(n-1) -7*a(n-2) +8*a(n-3) -7*a(n-4) +4*a(n-5) -a(n-6). - _Vincenzo Librandi_, Jun 27 2012
%t CoefficientList[Series[(1+2*x-x^2)*(1-x+x^2)/((1-x)^4*(1+x^2)),{x,0,50}],x] (* _Vincenzo Librandi_, Jun 27 2012 *)
%o (Magma) I:=[1, 5, 11, 20, 35, 57]; [n le 6 select I[n] else 4*Self(n-1)-7*Self(n-2)+8*Self(n-3)-7*Self(n-4)+4*Self(n-5)-Self(n-6): n in [1..50]]; // _Vincenzo Librandi_, Jun 27 2012
%Y Cf. A000292, A000330.
%K nonn,easy
%O 1,2
%A _Franklin T. Adams-Watters_, May 15 2006