A230832 Number of permutations of [n] with exactly one occurrence of the consecutive step pattern up, down, up, down.
0, 0, 0, 0, 0, 16, 192, 1472, 12800, 132352, 1366016, 14781952, 178102272, 2282645504, 30639611904, 440041603072, 6720063012864, 107722700685312, 1818098902499328, 32319047553515520, 601556224722337792, 11702621573275975680, 237913839294912397312
Offset: 0
Keywords
Examples
a(5) = 16: 13254, 14253, 14352, 15243, 15342, 23154, 24153, 24351, 25143, 25341, 34152, 34251, 35142, 35241, 45132, 45231. a(6) = 192: 124365, 125364, 125463, ..., 635241, 645132, 645231. a(7) = 1472: 1235476, 1236475, 1236574, ..., 7635241, 7645132, 7645231.
Links
- Alois P. Heinz, Table of n, a(n) for n = 0..460
Crossrefs
Column k=1 of A230797.
Programs
-
Maple
b:= proc(u, o, t) option remember; `if`(t=9, 0, `if`(u+o=0, `if`(t>4, 1, 0), add(b(u-j, o+j-1, [1, 3, 1, 5, 7, 9, 7, 5][t]), j=1..u)+ add(b(u+j-1, o-j, [2, 2, 4, 2, 6, 8, 8, 8][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 == 9, 0, If[u + o == 0, If[t > 4, 1, 0], Sum[b[u - j, o + j - 1, {1, 3, 1, 5, 7, 9, 7, 5}[[t]]], {j, 1, u}] + Sum[b[u + j - 1, o - j, {2, 2, 4, 2, 6, 8, 8, 8}[[t]]], {j, 1, o}]]]; a[n_] := b[n, 0, 1]; a /@ Range[0, 25] (* after Alois P. Heinz *)
Formula
a(n) ~ c * d^n * n! * n, where d = 0.87361286073825385348141673848..., c = 0.2252746... . - Vaclav Kotesovec, Aug 28 2014