cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A264896 Number of permutations of [n] with exactly one occurrence of the consecutive pattern 45321.

Original entry on oeis.org

1, 12, 126, 1344, 15110, 180736, 2308548, 31481472, 457520055, 7068885600, 115808906178, 2006533573632, 36674815572540, 705453732298240, 14248697953325160, 301564509817810944, 6674811622886359005, 154228999030804811520, 3713903962096887036390
Offset: 5

Views

Author

Alois P. Heinz, Nov 27 2015

Keywords

Comments

Consecutive patterns 12354, 21345, 54312 give the same sequence.

Examples

			a(5) = 1: 45321.
a(6) = 12: 156432, 256431, 356421, 453216, 456321, 463215, 546321, 563214, 564213, 564312, 564321, 645321.
		

Crossrefs

Column k=1 of A264781.

Programs

  • Maple
    b:= proc(u, o, t) option remember; `if`(u+o=0, 1, add(
           b(u+j-1, o-j, `if`(u+j-30, -1, `if`(t=-1, -2, 0)))), j=1..u),x,2),polynom))
        end:
    a:= n-> coeff(b(n, 0$2),x,1):
    seq(a(n), n=5..25);
  • Mathematica
    b[u_, o_, t_] := b[u, o, t] = If[u + o == 0, 1, Sum[b[u + j - 1, o - j, If[u + j - 3 < j, 0, j]], {j, 1, o}] + Expand[If[t == -2, x, 1]*Sum[b[u - j, o + j - 1, If[j < t || t == -2, 0, If[t > 0, -1, If[t == -1, -2, 0]]]], {j, 1, u}]]];
    a[n_] := Coefficient[b[n, 0, 0], x, 1];
    Table[a[n], {n, 5, 25}] (* Jean-François Alcover, Nov 01 2021, after Alois P. Heinz *)