login
Number of permutations of [n] with exactly two (possibly overlapping) occurrences of the consecutive step pattern {up}^2.
3

%I #16 Dec 21 2020 02:32:08

%S 0,0,0,0,1,8,86,803,8221,86214,966114,11405511,142934124,1892755874,

%T 26487024478,390658292572,6063383527327,98824236282650,

%U 1688354110698402,30179347977813309,563462569163994435,10970288500929001986,222384832378410907480

%N Number of permutations of [n] with exactly two (possibly overlapping) occurrences of the consecutive step pattern {up}^2.

%H Alois P. Heinz, <a href="/A230621/b230621.txt">Table of n, a(n) for n = 0..462</a>

%F a(n) ~ c * (3*sqrt(3)/(2*Pi))^n * n! * n^2, where c = 0.0359701024355206... . - _Vaclav Kotesovec_, Sep 06 2014

%e a(4) = 1: 1234.

%e a(5) = 8: 12354, 12453, 13452, 21345, 23451, 31245, 41235, 51234.

%e a(6) = 86: 123546, 123645, 123654, ..., 631245, 641235, 651234.

%e a(7) = 803: 1235476, 1236475, 1236547, ..., 7631245, 7641235, 7651234.

%p b:= proc(u, o, t) option remember;

%p `if`(t=7, 0, `if`(u+o=0, `if`(t in [4, 6], 1, 0),

%p add(b(u-j, o+j-1, [1, 1, 5, 6, 5, 6][t]), j=1..u)+

%p add(b(u+j-1, o-j, [2, 3, 4, 7, 3, 4][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[u + o == 0, 1,

%t Sum[b[u - j, o + j - 1, 1], {j, 1, u}] +

%t Sum[b[u + j - 1, o - j, 2]*If[t == 2, x, 1], {j, 1, o}] // Expand];

%t a[n_] := Coefficient[b[n, 0, 1], x, 2];

%t a /@ Range[0, 25] (* _Jean-François Alcover_, Dec 21 2020, after _Alois P. Heinz_ in A162975 *)

%Y Column k=2 of A162975.

%Y Cf. A230620.

%K nonn

%O 0,6

%A _Alois P. Heinz_, Oct 25 2013