A230621 Number of permutations of [n] with exactly two (possibly overlapping) occurrences of the consecutive step pattern {up}^2.
0, 0, 0, 0, 1, 8, 86, 803, 8221, 86214, 966114, 11405511, 142934124, 1892755874, 26487024478, 390658292572, 6063383527327, 98824236282650, 1688354110698402, 30179347977813309, 563462569163994435, 10970288500929001986, 222384832378410907480
Offset: 0
Keywords
Examples
a(4) = 1: 1234. a(5) = 8: 12354, 12453, 13452, 21345, 23451, 31245, 41235, 51234. a(6) = 86: 123546, 123645, 123654, ..., 631245, 641235, 651234. a(7) = 803: 1235476, 1236475, 1236547, ..., 7631245, 7641235, 7651234.
Links
- Alois P. Heinz, Table of n, a(n) for n = 0..462
Programs
-
Maple
b:= proc(u, o, t) option remember; `if`(t=7, 0, `if`(u+o=0, `if`(t in [4, 6], 1, 0), add(b(u-j, o+j-1, [1, 1, 5, 6, 5, 6][t]), j=1..u)+ add(b(u+j-1, o-j, [2, 3, 4, 7, 3, 4][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[u + o == 0, 1, Sum[b[u - j, o + j - 1, 1], {j, 1, u}] + Sum[b[u + j - 1, o - j, 2]*If[t == 2, x, 1], {j, 1, o}] // Expand]; a[n_] := Coefficient[b[n, 0, 1], x, 2]; a /@ Range[0, 25] (* Jean-François Alcover, Dec 21 2020, after Alois P. Heinz in A162975 *)
Formula
a(n) ~ c * (3*sqrt(3)/(2*Pi))^n * n! * n^2, where c = 0.0359701024355206... . - Vaclav Kotesovec, Sep 06 2014