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.

A228614 Number of permutations of [n] having a shortest ascending run of length one.

Original entry on oeis.org

0, 1, 1, 5, 18, 101, 611, 4452, 36287, 333395, 3382758, 37688597, 456839351, 5989023768, 84421235807, 1273482972215, 20470309460322, 349326503482301, 6307682420743595, 120157254334350828, 2408293016265606623, 50663563124372167787, 1116225038923857181614
Offset: 0

Views

Author

Alois P. Heinz, Aug 27 2013

Keywords

Examples

			a(1) = 1: 1.
a(2) = 1: 21.
a(3) = 5: 132, 213, 231, 312, 321.
a(4) = 18: 1243, 1342, 1432, 2134, 2143, 2341, 2431, 3124, 3142, 3214, 3241, 3421, 4123, 4132, 4213, 4231, 4312, 4321.
		

Crossrefs

Column k=1 of A064315.

Programs

  • Maple
    g:= proc(u, o) option remember; `if`(u+o<2, u,
          add(b(u-i, o+i-1), i=1..u) +add(g(u+i-1, o-i), i=1..o))
        end:
    b:= proc(u, o) option remember; `if`(u+o<2, 1-o,
          u*(u+o-1)! +add(g(u+i-1, o-i), i=1..o))
        end:
    a:= n-> add(b(j-1, n-j), j=1..n):
    seq(a(n), n=0..25);
  • Mathematica
    g[u_, o_] := g[u, o] = If[u + o < 2, u,
         Sum[b[u - i, o + i - 1], {i, u}] +
         Sum[g[u + i - 1, o - i], {i, o}]];
    b[u_, o_] := b[u, o] = If[u + o < 2, 1 - o, u*(u + o - 1)! +
         Sum[g[u + i - 1, o - i], {i, o}]];
    a[n_] := Sum[b[j - 1, n - j], {j, n}];
    Table[a[n], {n, 0, 25}] (* Jean-François Alcover, Aug 30 2021, after Alois P. Heinz *)

Formula

a(n) = A000142(n) - A097899(n).
E.g.f.: 1/(1-x) - sqrt(3)*exp(-x/2) / (2*cos(sqrt(3)*x/2+Pi/6)).

A186735 Number of permutations of [n] with no ascending runs of length 1 or 2.

Original entry on oeis.org

1, 0, 0, 1, 1, 1, 20, 69, 180, 1930, 12611, 61051, 566129, 5179750, 38348469, 376547340, 4169246332, 41559058969, 465750294781, 5905176350849, 72848728572828, 946103621115633, 13501160406995728, 195518567272213262, 2918439778172724571, 46559546190633191495
Offset: 0

Views

Author

Alois P. Heinz, Aug 29 2013

Keywords

Examples

			a(0) = 1: the empty permutation.
a(3) = 1: 123.
a(4) = 1: 1234.
a(5) = 1: 12345.
a(6) = 20: 123456, 124356, 125346, 126345, 134256, 135246, 136245, 145236, 146235, 156234, 234156, 235146, 236145, 245136, 246135, 256134, 345126, 346125, 356124, 456123.
		

Crossrefs

Programs

  • Mathematica
    A[n_, k_] := A[n, k] = Module[{b}, b[u_, o_, t_] := b[u, o, t] =
         If[t + o <= k, (u + o)!,
         Sum[b[u + i - 1, o - i, Min[k, t] + 1], {i, 1, o}] +
         If[t <= k, u*(u + o - 1)!,
         Sum[b[u - i, o + i - 1, 1], {i, 1, u}]]];
      Sum[b[j - 1, n - j, 1], {j, 1, n}]];
    a[n_] := n! - A[n, 2];
    Table[a[n], {n, 0, 25}] (* Jean-François Alcover, Sep 03 2021, after Alois P. Heinz in A064315 *)

Formula

a(n) = A000142(n) - A228614(n) - A185652(n).
Showing 1-2 of 2 results.