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”).

Number T(n,k) of permutations p of [n] with no fixed points where the maximal displacement of an element equals k; triangle T(n,k), n>=0, 0<=k<=n, read by rows.
13

%I #25 May 05 2019 08:58:04

%S 1,0,0,0,1,0,0,0,2,0,0,1,3,5,0,0,0,6,18,20,0,0,1,12,44,111,97,0,0,0,

%T 24,116,396,744,574,0,0,1,44,331,1285,3628,5571,3973,0,0,0,84,932,

%U 4312,15038,34948,46662,31520,0,0,1,159,2532,15437,59963,181193,359724,434127,281825,0

%N Number T(n,k) of permutations p of [n] with no fixed points where the maximal displacement of an element equals k; triangle T(n,k), n>=0, 0<=k<=n, read by rows.

%H Alois P. Heinz, <a href="/A259784/b259784.txt">Rows n = 0..20, flattened</a>

%F T(n,k) = A259776(n,k) - A259776(n,k-1) for k>0, T(n,0) = A000007(n).

%e Triangle T(n,k) begins:

%e 1;

%e 0, 0;

%e 0, 1, 0;

%e 0, 0, 2, 0;

%e 0, 1, 3, 5, 0;

%e 0, 0, 6, 18, 20, 0;

%e 0, 1, 12, 44, 111, 97, 0;

%e 0, 0, 24, 116, 396, 744, 574, 0;

%e 0, 1, 44, 331, 1285, 3628, 5571, 3973, 0;

%p b:= proc(n, s, k) option remember; `if`(n=0, 1, `if`(n+k in s,

%p b(n-1, (s minus {n+k}) union `if`(n-k>1, {n-k-1}, {}), k),

%p add(`if`(j=n, 0, b(n-1, (s minus {j}) union

%p `if`(n-k>1, {n-k-1}, {}), k)), j=s)))

%p end:

%p A:= (n, k)-> `if`(k=0, `if`(n=0, 1, 0), b(n, {$max(1, n-k)..n}, k)):

%p T:= (n, k)-> A(n, k) -`if`(k=0, 0, A(n, k-1)):

%p seq(seq(T(n, k), k=0..n), n=0..12);

%t b[n_, s_, k_] := b[n, s, k] = If[n==0, 1, If[MemberQ[s, n+k], b[n-1, (s ~Complement~ {n+k}) ~Union~ If[n-k>1, {n-k-1}, {}], k], Sum[If[j==n, 0, b[n-1, (s ~Complement~ {j}) ~Union~ If[n-k>1, {n-k-1}, {}], k]], {j, s}]] ];

%t A[n_, k_] := If[k == 0, If[n == 0, 1, 0], b[n, Range[Max[1, n-k], n], k]];

%t T[n_, k_] := A[n, k] - If[k == 0, 0, A[n, k-1]];

%t Table[T[n, k], {n, 0, 12}, {k, 0, n}] // Flatten (* _Jean-François Alcover_, May 05 2019, after _Alois P. Heinz_ *)

%Y Rows sums give A000166.

%Y Column k=0 and main diagonal give A000007.

%Y Columns k=1-10 give: A059841 (for n>0), A321048, A321049, A321050, A321051, A321052, A321053, A321054, A321055, A321056.

%Y First lower diagonal gives A259834.

%Y T(2n,n) gives A259785.

%Y Cf. A259776.

%K nonn,tabl

%O 0,9

%A _Alois P. Heinz_, Jul 05 2015