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.

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.

This page as a plain text file.
%I A249631 #19 Nov 20 2014 06:07:11
%S A249631 2,2,6,2,12,24,2,20,72,120,2,34,180,480,720,2,56,428,1632,3600,5040,2,
%T A249631 88,1042,5124,15600,30240,40320,2,136,2512,15860,61872,159840,282240,
%U A249631 362880,2,208,5912,50186,236388,773040,1764000,2903040,3628800
%N 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.
%H A249631 Li-yao Xia, <a href="/A249631/a249631.txt">Triangle of T(n,k) for n=2..10, k=2..n</a>
%e A249631 Triangle starts with n=2:
%e A249631 2;
%e A249631 2,  6;
%e A249631 2, 12,  24;
%e A249631 2, 20,  72, 120;
%e A249631 2, 34, 180, 480, 720;
%o A249631 (Haskell) a n x = filter (\l -> all (< x) (zipWith (\x y -> abs (x - y)) l (tail l))) (permutations [1 .. n])
%o A249631 (PARI) isokp(perm, k) = {for (i=1, #perm-1, if (abs(perm[i]-perm[i+1]) >= k, return (0));); return (1);}
%o A249631 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
%Y A249631 Cf. A000142, main diagonal, A062119, subdiagonal.
%Y A249631 Cf. A003274, A174700, A174701, A174702, 2nd to 5th columns, T(n,k), k=3,4,5,6.
%Y A249631 Cf. A174703, A174704, A174705, A174706, A174707, A174708, similar definitions.
%K A249631 nonn,tabl
%O A249631 2,1
%A A249631 _Li-yao Xia_, Nov 02 2014