A264896 Number of permutations of [n] with exactly one occurrence of the consecutive pattern 45321.
1, 12, 126, 1344, 15110, 180736, 2308548, 31481472, 457520055, 7068885600, 115808906178, 2006533573632, 36674815572540, 705453732298240, 14248697953325160, 301564509817810944, 6674811622886359005, 154228999030804811520, 3713903962096887036390
Offset: 5
Keywords
Examples
a(5) = 1: 45321. a(6) = 12: 156432, 256431, 356421, 453216, 456321, 463215, 546321, 563214, 564213, 564312, 564321, 645321.
Links
- Alois P. Heinz, Table of n, a(n) for n = 5..200
Crossrefs
Column k=1 of A264781.
Programs
-
Maple
b:= proc(u, o, t) option remember; `if`(u+o=0, 1, add( b(u+j-1, o-j, `if`(u+j-3
0, -1, `if`(t=-1, -2, 0)))), j=1..u),x,2),polynom)) end: a:= n-> coeff(b(n, 0$2),x,1): seq(a(n), n=5..25); -
Mathematica
b[u_, o_, t_] := b[u, o, t] = If[u + o == 0, 1, Sum[b[u + j - 1, o - j, If[u + j - 3 < j, 0, j]], {j, 1, o}] + Expand[If[t == -2, x, 1]*Sum[b[u - j, o + j - 1, If[j < t || t == -2, 0, If[t > 0, -1, If[t == -1, -2, 0]]]], {j, 1, u}]]]; a[n_] := Coefficient[b[n, 0, 0], x, 1]; Table[a[n], {n, 5, 25}] (* Jean-François Alcover, Nov 01 2021, after Alois P. Heinz *)
Comments