A356257 Irregular triangle: row n consists of the frequencies of positive distances between permutations P and reverse(P), as P ranges through the permutations of (1, 2, ..., n); see Comments.
1, 2, 4, 2, 8, 16, 24, 16, 32, 32, 16, 48, 192, 192, 288, 192, 144, 576, 576, 576, 576, 960, 576, 576, 288, 384, 2304, 4608, 7680, 9216, 6912, 9216, 1920, 1536, 9216, 9216, 16128, 18432, 29184, 26112, 36864, 32256, 41472, 23040, 39168, 32256, 18432, 18432
Offset: 1
Examples
First 8 rows: 1 2 4 2 8 16 24 16 32 32 16 48 192 192 288 192 144 576 576 576 576 960 576 576 288 384 2304 4608 7680 9216 6912 9216 For n=3, the 6 permutations and their reverses are represented by 123 132 213 231 212 321 321 231 312 132 213 123, so the 6 distances are 4,2,2,2,2,4, whence row 3 accounts for four 2's and two 4's.
Programs
-
Mathematica
p[n_] := p[n] = Permutations[Range[n]]; f[n_, k_] := f[n, k] = Abs[p[n][[k]] - Reverse[p[n][[k]]]] c[n_, k_] := c[n, k] = Total[f[n, k]] t[n_] := t[n] = Table[c[n, k], {k, 1, n!}] z = 6; Table[t[n], {n, 1, z}] u = Table[Count[t[n], k], {n, 1, z}, {k, Min[t[n]], Max[t[n]], 2}] v[n_] := Select[u[[n]], # > 0 &] w = Table[v[n], {n, 1, z}] TableForm[w] (* 356257 array *) Flatten[w] (* 356257 sequence *)
Comments