login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A249631
Number of permutations p of {1,...,n} such that |p(i+1)-p(i)| < k, k=2,...,n; T(n,k), read by rows.
1
2, 2, 6, 2, 12, 24, 2, 20, 72, 120, 2, 34, 180, 480, 720, 2, 56, 428, 1632, 3600, 5040, 2, 88, 1042, 5124, 15600, 30240, 40320, 2, 136, 2512, 15860, 61872, 159840, 282240, 362880, 2, 208, 5912, 50186, 236388, 773040, 1764000, 2903040, 3628800
OFFSET
2,1
EXAMPLE
Triangle starts with n=2:
2;
2, 6;
2, 12, 24;
2, 20, 72, 120;
2, 34, 180, 480, 720;
PROG
(Haskell) a n x = filter (\l -> all (< x) (zipWith (\x y -> abs (x - y)) l (tail l))) (permutations [1 .. n])
(PARI) isokp(perm, k) = {for (i=1, #perm-1, if (abs(perm[i]-perm[i+1]) >= k, return (0)); ); return (1); }
tabl(nn) = {for (n=2, nn, for (k=2, n, print1(sum(i=1, n!, isokp(numtoperm(n, i), k)), ", "); ); print(); ); } \\ Michel Marcus, Nov 06 2014
CROSSREFS
Cf. A000142, main diagonal, A062119, subdiagonal.
Cf. A003274, A174700, A174701, A174702, 2nd to 5th columns, T(n,k), k=3,4,5,6.
Cf. A174703, A174704, A174705, A174706, A174707, A174708, similar definitions.
Sequence in context: A284012 A278243 A071223 * A055934 A096217 A281145
KEYWORD
nonn,tabl
AUTHOR
Li-yao Xia, Nov 02 2014
STATUS
approved