OFFSET
0,3
COMMENTS
A length n inversion sequence e_1e_2...e_n is a sequence of integers such that 0 <= e_i < i. The term a(n) counts the inversion sequences of length n with no entries e_i, e_{i+1}, e_{i+2} such that e_i > e_{i+1} != e_{i+2}. This is the same as the set of inversion sequences of length n avoiding the consecutive patterns 101, 102, 201, and 210.
LINKS
Juan S. Auli and Sergi Elizalde, Consecutive patterns in inversion sequences II: avoiding patterns of relations, arXiv:1906.07365 [math.CO], 2019.
EXAMPLE
Note that a(4)=21. Indeed, of the 24 inversion sequences of length 4, the only ones that do not avoid the consecutive patterns 101, 102, 201, and 210 are 0101, 0102 and 0103.
MAPLE
# after Alois P. Heinz in A328357
b := proc(n, x, t) option remember; `if`(n=0, 1, add(
`if`(t and i>x, 0, b(n-1, i, i<>x and x>-1)), i=0..n-1))
end proc:
a := n -> b(n, -1, false):
seq(a(n), n = 0 .. 24);
MATHEMATICA
b[n_, x_, t_] := b[n, x, t] = If[n == 0, 1, Sum[If[t && i > x, 0, b[n - 1, i, i != x && x > -1]], {i, 0, n - 1}]];
a[n_] := b[n, -1, False];
CROSSREFS
KEYWORD
nonn
AUTHOR
Juan S. Auli, Oct 16 2019
STATUS
approved