%I #18 Dec 22 2020 03:54:19
%S 0,0,0,0,0,16,192,1472,12800,132352,1366016,14781952,178102272,
%T 2282645504,30639611904,440041603072,6720063012864,107722700685312,
%U 1818098902499328,32319047553515520,601556224722337792,11702621573275975680,237913839294912397312
%N Number of permutations of [n] with exactly one occurrence of the consecutive step pattern up, down, up, down.
%H Alois P. Heinz, <a href="/A230832/b230832.txt">Table of n, a(n) for n = 0..460</a>
%F a(n) ~ c * d^n * n! * n, where d = 0.87361286073825385348141673848..., c = 0.2252746... . - _Vaclav Kotesovec_, Aug 28 2014
%e a(5) = 16: 13254, 14253, 14352, 15243, 15342, 23154, 24153, 24351, 25143, 25341, 34152, 34251, 35142, 35241, 45132, 45231.
%e a(6) = 192: 124365, 125364, 125463, ..., 635241, 645132, 645231.
%e a(7) = 1472: 1235476, 1236475, 1236574, ..., 7635241, 7645132, 7645231.
%p b:= proc(u, o, t) option remember; `if`(t=9, 0,
%p `if`(u+o=0, `if`(t>4, 1, 0),
%p add(b(u-j, o+j-1, [1, 3, 1, 5, 7, 9, 7, 5][t]), j=1..u)+
%p add(b(u+j-1, o-j, [2, 2, 4, 2, 6, 8, 8, 8][t]), j=1..o)))
%p end:
%p a:= n-> b(n, 0, 1):
%p seq(a(n), n=0..25);
%t b[u_, o_, t_] := b[u, o, t] = If[t == 9, 0,
%t If[u + o == 0, If[t > 4, 1, 0],
%t Sum[b[u - j, o + j - 1, {1, 3, 1, 5, 7, 9, 7, 5}[[t]]], {j, 1, u}] +
%t Sum[b[u + j - 1, o - j, {2, 2, 4, 2, 6, 8, 8, 8}[[t]]], {j, 1, o}]]];
%t a[n_] := b[n, 0, 1];
%t a /@ Range[0, 25] (* after _Alois P. Heinz_ *)
%Y Column k=1 of A230797.
%K nonn
%O 0,6
%A _Alois P. Heinz_, Oct 30 2013
|