cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

This page as a plain text file.
%I A356257 #17 Jun 05 2023 08:55:48
%S A356257 1,2,4,2,8,16,24,16,32,32,16,48,192,192,288,192,144,576,576,576,576,
%T A356257 960,576,576,288,384,2304,4608,7680,9216,6912,9216,1920,1536,9216,
%U A356257 9216,16128,18432,29184,26112,36864,32256,41472,23040,39168,32256,18432,18432
%N 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.
%C A356257 For n >= 1, let P = (p(1),p(2),...,p(n)) and Q = (q(1),q(2),...,q(n)) be permutations of (1,2,...,n). The distance between P and Q is defined by |p(1)-q(1)| + |p(2)-q(2)| + ... + |p(n)-q(n)|. For fixed n >= 1, let m be the least distance that occurs and let M be the greatest. If n is odd, let S = (m, m+2, m+4, ..., M); if n > 2 is even, let S = (m, m+4, m+8, ..., M).  Then S gives all the positive distances that occur, and the frequencies in row n of the array account for the distances in S.  Four open questions about the numbers in row n follow.  (1) How many are there? (2) What are the first and last? (3) What are the least and greatest? (4) What is the greatest common divisor?
%e A356257 First 8 rows:
%e A356257     1
%e A356257     2
%e A356257     4      2
%e A356257     8     16
%e A356257    24     16    32    32    16
%e A356257    48    192   192   288
%e A356257   192    144   576   576   576   576    960    576    576    288
%e A356257   384   2304  4608  7680  9216  6912   9216
%e A356257 For n=3, the 6 permutations and their reverses are represented by
%e A356257   123 132 213 231 212 321
%e A356257   321 231 312 132 213 123,
%e A356257 so the 6 distances are 4,2,2,2,2,4, whence row 3 accounts for four 2's and two 4's.
%t A356257 p[n_] := p[n] = Permutations[Range[n]];
%t A356257 f[n_, k_] := f[n, k] = Abs[p[n][[k]] - Reverse[p[n][[k]]]]
%t A356257 c[n_, k_] := c[n, k] = Total[f[n, k]]
%t A356257 t[n_] := t[n] = Table[c[n, k], {k, 1, n!}]
%t A356257 z = 6; Table[t[n], {n, 1, z}]
%t A356257 u = Table[Count[t[n], k], {n, 1, z}, {k, Min[t[n]], Max[t[n]], 2}]
%t A356257 v[n_] := Select[u[[n]], # > 0 &]
%t A356257 w = Table[v[n], {n, 1, z}]
%t A356257 TableForm[w] (* 356257 array *)
%t A356257 Flatten[w]   (* 356257 sequence *)
%Y A356257 Cf. A000142 (row sums), A357329.
%K A356257 nonn,tabf,more
%O A356257 1,2
%A A356257 _Clark Kimberling_, Oct 04 2022