%I #33 Apr 26 2023 09:56:16
%S 0,1,12,156,2360,41400,831012,18832576,476200944,13301078400,
%T 406907517500,13534968927744,486470108273448,18790567023993856,
%U 776343673316956500,34165751933338828800,1595693034061797583328,78831769938218360930304,4107393289066148637198444
%N a(n) = A001864(n+1)/2.
%C This is Sum_{all n^(n-2) labeled trees T on n nodes} Sum_{1<=i<j<=n} distance(node i, node j).
%C a(n) is the total number of all defects in defective parking functions of length n+1. - _Alois P. Heinz_, Nov 28 2015
%C With offset 1, a(n) is the number of unordered pairs {f,g} where for some nonempty proper subset S of [n], f:S->S and g:[n]\S->[n]\S. - _Geoffrey Critzer_, Apr 23 2017
%H Alois P. Heinz, <a href="/A036276/b036276.txt">Table of n, a(n) for n = 0..380</a>
%H J. Riordan and N. J. A. Sloane, <a href="http://dx.doi.org/10.1017/S1446788700007527">Enumeration of rooted trees by total height</a>, J. Austral. Math. Soc., vol. 10 pp. 278-282, 1969.
%H Peter Winkler, <a href="https://doi.org/10.1016/0166-218X(90)90137-2">Mean distance in a tree</a>, in Computational algorithms, operations research and computer science (Burnaby, BC, 1987). Discrete Appl. Math. 27 (1990), no. 1-2, 179-185. [For background information only.]
%F a(n) = Sum_{k>0} k * A264902(n+1,k). - _Alois P. Heinz_, Nov 28 2015
%t Table[Sum[Binomial[n, k] (n - k)^(n - k) k^k, {k, n - 1}]/2, {n, 18}] (* _Michael De Vlieger_, Apr 24 2017, after _Harvey P. Dale_ at A001864 *)
%o (Python)
%o from math import math
%o def A036276(n): return sum(comb(n+1,k)*(n+1-k)**(n+1-k)*k**k for k in range(1,(n>>1)+1)) + (comb(n+1,m:=n+1>>1)*m**(n+1)>>1 if n&1 else 0) # _Chai Wah Wu_, Apr 26 2023
%Y Cf. A001864, A264902.
%K nonn,easy
%O 0,3
%A _N. J. A. Sloane_.