A230620 Number of permutations of [n] with at least two (possibly overlapping) occurrences of the consecutive step pattern {up}^2.
0, 0, 0, 0, 1, 9, 97, 983, 10616, 119932, 1441405, 18383351, 249155667, 3581896559, 54540748818, 877824410030, 14904605652001, 266431586957773, 5004557444810885, 98594548150006583, 2033673324306909868, 43845407809459639440, 986496730691143433269
Offset: 0
Keywords
Examples
a(4) = 1: 1234. a(5) = 9: 12345, 12354, 12453, 13452, 21345, 23451, 31245, 41235, 51234. a(6) = 97: 123456, 123465, 123546, ..., 631245, 641235, 651234. a(7) = 983: 1234567, 1234576, 1234657, ..., 7631245, 7641235, 7651234.
Links
- Alois P. Heinz, Table of n, a(n) for n = 0..200
Crossrefs
Cf. A230621.
Programs
-
Maple
b:= proc(u, o, t) option remember; `if`(t=5, (u+o)!, `if`(u+o+t<4, 0, add(b(u-j, o+j-1, [1, 1, 4, 4][t]), j=1..u)+ add(b(u+j-1, o-j, [2, 3, 5, 3][t]), j=1..o))) end: a:= n-> b(n, 0, 1): seq(a(n), n=0..25);
-
Mathematica
b[u_, o_, t_] := b[u, o, t] = If[t == 5, (u + o)!, If[u + o + t < 4, 0, Sum[b[u - j, o + j - 1, {1, 1, 4, 4}[[t]]], {j, 1, u}] + Sum[b[u + j - 1, o - j, {2, 3, 5, 3}[[t]]], {j, 1, o}]]]; a[n_] := b[n, 0, 1]; a /@ Range[0, 25] (* Jean-François Alcover, Dec 22 2020, after Alois P. Heinz *)
Formula
a(n) = Sum_{i=2..n-2} A162975(n,i).
a(n) ~ n!. - Vaclav Kotesovec, Sep 06 2014