%I #26 May 11 2024 18:57:10
%S 0,4,72,1280,25000,544320,13176688,352321536,10331213040,330000000000,
%T 11412466824440,425000788033536,16961005969166168,722280443661271040,
%U 32696077148437500000,1567973246265311887360,79415065141088329360992,4236296602773593878953984
%N The work performed by a function f:{1,...,n} -> {1,...,n} is defined to be work(f) = Sum_{i=1..n} |i - f(i)|; a(n) is equal to sum(work(f)) where the sum is over all functions f:{1,...,n}->{1,...,n}.
%H Vincenzo Librandi, <a href="/A111868/b111868.txt">Table of n, a(n) for n = 1..300</a>
%H James East, <a href="http://www.maths.usyd.edu.au/u/pubs/publist/preprints/2005/east-35.html">The Work Performed by a Transformation Semigroup</a>, preprint 2005.
%F a(n) = n^n*(n^2-1) / 3. - _Franklin T. Adams-Watters_, Dec 14 2006
%e When n=2 there are 4 maps {1,2}->{1,2}. these are (1 1), (2 2), (1 2), (2 1), where we show the map f:{1,2}->{1,2} as (f(1) f(2)). Adding up the work performed by these maps (from left to right as arranged above) gives a(2)=1+1+0+2=4.
%t Table[n^n (n^2-1)/3,{n,20}] (* _Harvey P. Dale_, Sep 24 2011 *)
%o (Magma) [n^n*(n^2-1) / 3: n in [1..20]]; // _Vincenzo Librandi_, Sep 25 2011
%Y Cf. A111873, A111874, A111903.
%K easy,nonn,nice
%O 1,2
%A _James East_, Nov 23 2005
%E More terms from _Franklin T. Adams-Watters_, Dec 14 2006
|