A262241 Number of ordered pairs (p,q) of permutations of [n] with complementary up-down signatures and p(1)=q(1) if n>0.
1, 1, 0, 2, 12, 144, 2456, 58376, 1836064, 73967072, 3714221440, 227511703296, 16699185465088, 1446996011652864, 146157945571218944, 17023105015524481536, 2264733463688117325824, 341323210761171895406592, 57851227793596711612702720
Offset: 0
Keywords
Examples
a(1) = 1: (1,1). a(2) = 0. a(3) = 2: (213,231), (231,213). a(4) = 12: (2134,2431), (2143,2314), (2143,2413), (2314,2143), (2413,2143), (2431,2134), (3124,3421), (3142,3412), (3241,3412), (3412,3142), (3412,3241), (3421,3124).
Links
- Alois P. Heinz, Table of n, a(n) for n = 0..110
Programs
-
Maple
b:= proc(u, o, h) option remember; `if`(u+o=0, 1, add(add(b(u-j, o+j-1, h-i), i=1..h), j=1..u)+ add(add(b(u+j-1, o-j, h+i-1), i=1..u+o-h), j=1..o)) end: a:= n-> `if`(n=0, 1, add(b(j-1, n-j, n-j), j=1..n)): seq(a(n), n=0..20);
-
Mathematica
b[u_, o_, h_] := b[u, o, h] = If[u + o == 0, 1, Sum[Sum[b[u - j, o + j - 1, h - i], {i, h}], {j, u}] + Sum[Sum[b[u + j - 1, o - j, h + i - 1], {i, u + o - h}], {j, o}]]; a[n_] := If[n == 0, 1, Sum[b[j - 1, n - j, n - j], {j, n}]]; Table[a[n], {n, 0, 20}] (* Jean-François Alcover, Aug 30 2021, after Alois P. Heinz *)
Comments