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.

Showing 1-2 of 2 results.

A295987 Number T(n,k) of permutations of [n] with exactly k (possibly overlapping) occurrences of the consecutive step patterns 010 or 101, where 1=up and 0=down; triangle T(n,k), n >= 0, k = max(0, n-3), read by rows.

Original entry on oeis.org

1, 1, 2, 6, 14, 10, 52, 36, 32, 204, 254, 140, 122, 1010, 1368, 1498, 620, 544, 5466, 9704, 9858, 9358, 3164, 2770, 34090, 67908, 90988, 72120, 63786, 18116, 15872, 233026, 545962, 762816, 839678, 560658, 470262, 115356, 101042, 1765836, 4604360, 7458522
Offset: 0

Views

Author

Alois P. Heinz, Dec 01 2017

Keywords

Examples

			Triangle T(n,k) begins:
:      1;
:      1;
:      2;
:      6;
:     14,     10;
:     52,     36,     32;
:    204,    254,    140,    122;
:   1010,   1368,   1498,    620,    544;
:   5466,   9704,   9858,   9358,   3164,   2770;
:  34090,  67908,  90988,  72120,  63786,  18116,  15872;
: 233026, 545962, 762816, 839678, 560658, 470262, 115356, 101042;
		

Crossrefs

Column k=0 gives A295974.
Last elements of rows for n>3 give: A001250, A260786, 2*A000111.
Row sums give A000142.

Programs

  • Maple
    b:= proc(u, o, t, h) option remember; expand(
               `if`(u+o=0, 1, `if`(t=0, add(b(u-j, j-1, 1$2), j=1..u),
           add(`if`(h=3, x, 1)*b(u-j, o+j-1, [1, 3, 1][t], 2), j=1..u)+
           add(`if`(t=3, x, 1)*b(u+j-1, o-j, 2, [1, 3, 1][h]), j=1..o))))
        end:
    T:= n-> (p-> seq(coeff(p, x, i), i=0..degree(p)))(b(n, 0$3)):
    seq(T(n), n=0..12);
  • Mathematica
    b[u_, o_, t_, h_] := b[u, o, t, h] = Expand[If[u + o == 0, 1, If[t == 0, Sum[b[u - j, j - 1, 1, 1], {j, 1, u}], Sum[If[h == 3, x, 1]*b[u - j, o + j - 1, {1, 3, 1}[[t]], 2], {j, 1, u}] + Sum[If[t == 3, x, 1]*b[u + j - 1, o - j, 2, {1, 3, 1}[[h]]], {j, 1, o}]]]];
    T[n_] := Function[p, Table[Coefficient[p, x, i], {i, 0, Exponent[p, x]}]][ b[n, 0, 0, 0]];
    Table[T[n], {n, 0, 12}] // Flatten (* Jean-François Alcover, Jun 07 2018, from Maple *)

A296054 Number of permutations of [n] with an equal number of occurrences of the consecutive step patterns 010 and 101, where 1=up and 0=down.

Original entry on oeis.org

1, 1, 2, 6, 14, 84, 344, 2714, 15850, 158664, 1254536, 15066332, 151035364, 2091499222, 25438986270, 398610118170, 5712650790562, 99963273184972, 1649446030193764, 31890910904182000, 594935710367215600, 12604160312187654888, 262094375885982582488
Offset: 0

Views

Author

Alois P. Heinz, Dec 03 2017

Keywords

Comments

a(n) * sqrt(n) / n! tends to 1.064409... - Vaclav Kotesovec, Aug 30 2021

Examples

			a(4) = 14: 1234, 1243, 1342, 1432, 2134, 2341, 2431, 3124, 3214, 3421, 4123, 4213, 4312, 4321 with step patterns 111, 110, 110, 100, 011, 110, 100, 011, 001, 100, 011, 001, 001, 000, respectively.
		

Crossrefs

Programs

  • Maple
    b:= proc(u, o, t, h, c) option remember; `if`(2*abs(c)-1>u+o, 0,
                `if`(u+o=0, 1, `if`(t=0, add(b(u-j, j-1, 1$2, 0), j=1..u),
           add(b(u-j, o+j-1, [1, 3, 1][t], 2, c+`if`(h=3, 1, 0)), j=1..u)+
           add(b(u+j-1, o-j, 2, [1, 3, 1][h], c-`if`(t=3, 1, 0)), j=1..o))))
        end:
    a:= n-> b(n, 0$4):
    seq(a(n), n=0..30);
  • Mathematica
    b[u_, o_, t_, h_, c_] := b[u, o, t, h, c] = If[2 Abs[c] - 1 > u+o, 0,
         If[u+o == 0, 1, If[t == 0, Sum[b[u-j, j-1, 1, 1, 0], {j, u}],
         Sum[b[u-j, o+j-1, {1, 3, 1}[[t]], 2, c+If[h == 3, 1, 0]], {j, u}]+
         Sum[b[u+j-1, o-j, 2, {1, 3, 1}[[h]], c-If[t == 3, 1, 0]], {j, o}]]]];
    a[n_] := b[n, 0, 0, 0, 0];
    Table[a[n], {n, 0, 30}] (* Jean-François Alcover, Aug 30 2021, after Alois P. Heinz *)
Showing 1-2 of 2 results.