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.

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