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-3 of 3 results.

A228422 Number of permutations of [n] with exactly two (possibly overlapping) occurrences of some of the consecutive patterns 123, 1432, 2431, 3421.

Original entry on oeis.org

0, 0, 0, 0, 1, 14, 164, 1589, 15034, 139465, 1334945, 13108425, 134906641, 1443572465, 16238742806, 190546010823, 2347715040542, 30162115442344, 405859441345002, 5684963539755583, 83163913991455832, 1263763900212930657, 20000260465018111763
Offset: 0

Views

Author

Alois P. Heinz, Nov 09 2013

Keywords

Examples

			a(4) = 1: 1234.
a(5) = 14: 12354, 12453, 12543, 13452, 13542, 14532, 21345, 23451, 23541, 24531, 31245, 34521, 41235, 51234.
		

Crossrefs

Column k=2 of A231210.

Programs

  • Maple
    b:= proc(u, o, t, c) option remember;
          `if`(c<0, 0, `if`(u+o=0, `if`(c=0, 1, 0),
          add(b(u+j-1, o-j, [2, 2, 2][t], `if`(t=2, c-1, c)), j=1..o)+
          add(b(u-j, o+j-1, [1, 3, 1][t], `if`(t=3, c-1, c)), j=1..u)))
        end:
    a:= n-> b(n, 0, 1, 2):
    seq(a(n), n=0..25);
  • Mathematica
    b[u_, o_, t_, c_] := b[u, o, t, c] =
        If[c<0, 0, If[u+o == 0, If[c == 0, 1, 0],
        Sum[b[u+j-1, o-j, 2,              If[t == 2, c-1, c]], {j, 1, o}] +
        Sum[b[u-j, o+j-1, {1, 3, 1}[[t]], If[t == 3, c-1, c]], {j, 1, u}]]];
    a[n_] := b[n, 0, 1, 2];
    Table[a[n], {n, 0, 25}] (* Jean-François Alcover, Dec 20 2020, after Alois P. Heinz *)

Formula

a(n) ~ c * (2/Pi)^n * n! * n^2, where c = 1.286210080518397686... . - Vaclav Kotesovec, Aug 28 2014

A231211 Number of permutations of [n] avoiding simultaneously consecutive patterns 123, 1432, 2431, and 3421.

Original entry on oeis.org

1, 1, 2, 5, 14, 46, 177, 790, 4024, 23056, 146777, 1027850, 7852184, 64985116, 579191277, 5530869310, 56336971744, 609708912976, 6986749484177, 84510154473170, 1076016705993704, 14385283719409636, 201475033030143477, 2950048762311387430, 45073424916825354064
Offset: 0

Views

Author

Alois P. Heinz, Nov 05 2013

Keywords

Comments

Number of permutations of [n] avoiding simultaneously consecutive step patterns up, up and up, down, down.

Examples

			a(3) = 5: 132, 213, 231, 312, 321.
a(4) = 14: 1324, 1423, 2143, 2314, 2413, 3142, 3214, 3241, 3412, 4132, 4213, 4231, 4312, 4321.
a(5) = 46: 13254, 14253, 14352, ..., 54231, 54312, 54321.
a(6) = 177: 132546, 132645, 142536, ..., 654231, 654312, 654321.
		

Crossrefs

Column k=0 of A231210.

Programs

  • Maple
    b:= proc(u, o, t) option remember; `if`(t=4, 0, `if`(u+o=0, 1,
          add(b(u+j-1, o-j, [2, 4, 2][t]), j=1..o)+
          add(b(u-j, o+j-1, [1, 3, 4][t]), j=1..u)))
        end:
    a:= n-> b(n, 0, 1):
    seq(a(n), n=0..30);
    # second Maple program
    n:=40: c[0,0]:=1: for i to n-1 do c[i,0]:=0 end do: for i to n-1 do for j to i do c[i,j] := c[i,j-1] + c[i-1,i-j] + 1 end do end do: 1, seq(c[k, k]/2, k=1..n-1); # Sergei N. Gladkovskii, Jul 27 2015
  • Mathematica
    b[u_, o_, t_] := b[u, o, t] = If[t == 4, 0, If[u + o == 0, 1,
        Sum[b[u + j - 1, o - j, {2, 4, 2}[[t]]], {j, 1, o}] +
        Sum[b[u - j, o + j - 1, {1, 3, 4}[[t]]], {j, 1, u}]]];
    a[n_] := b[n, 0, 1];
    a /@ Range[0, 30] (* Jean-François Alcover, Dec 22 2020, after Alois P. Heinz *)

Formula

a(n) ~ (1+exp(Pi/2)) * (2/Pi)^(n+1) * n!. - Vaclav Kotesovec, Aug 28 2014

A231228 Number of permutations of [n] with exactly one occurrence of one of the consecutive patterns 123, 1432, 2431, 3421.

Original entry on oeis.org

0, 0, 0, 1, 9, 59, 358, 2235, 14658, 103270, 778451, 6315499, 54733657, 507655301, 5003179539, 52430810493, 580611272956, 6796733911852, 83658527086447, 1083027034959367, 14678725047527255, 208344799726820123, 3084495765476262875, 47646333262275943521
Offset: 0

Views

Author

Alois P. Heinz, Nov 05 2013

Keywords

Examples

			a(3) = 1: 123.
a(4) = 9: 1243, 1342, 1432, 2134, 2341, 2431, 3124, 3421, 4123.
a(5) = 59: 12435, 12534, 13245, ..., 53124, 53421, 54123.
a(6) = 358: 124365, 125364, 125463, ..., 653124, 653421, 654123.
		

Crossrefs

Column k=1 of A231210.

Programs

  • Maple
    b:= proc(u, o, t) option remember;
          `if`(t=7, 0, `if`(u+o=0, `if`(t in [4, 5, 6], 1, 0),
          add(b(u+j-1, o-j, [2, 5, 2, 5, 7, 5][t]), j=1..o)+
          add(b(u-j, o+j-1, [1, 3, 4, 4, 6, 7][t]), j=1..u)))
        end:
    a:= n-> b(n, 0, 1):
    seq(a(n), n=0..25);
  • Mathematica
    b[u_, o_, t_] := b[u, o, t] = If[t==7, 0, If[u+o==0, If[4 <= t <= 6, 1, 0],
          Sum[b[u + j - 1, o - j, {2, 5, 2, 5, 7, 5}[[t]]], {j, 1, o}] +
          Sum[b[u - j, o + j - 1, {1, 3, 4, 4, 6, 7}[[t]]], {j, 1, u}]]];
    a[n_] := b[n, 0, 1];
    a /@ Range[0, 25] (* Jean-François Alcover, Jan 03 2021, after Alois P. Heinz *)

Formula

a(n) ~ c * (2/Pi)^n * n! * n, where c = 3.08472832460941829086964816782... . - Vaclav Kotesovec, Aug 28 2014
Showing 1-3 of 3 results.