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.

A216837 Number of permutations p of {1,...,n} such that at most one element of {p(1),...,p(i-1)} is between p(i) and p(i+1) for all i from 1 to n-1.

Original entry on oeis.org

1, 1, 2, 6, 20, 72, 268, 1020, 3936, 15332, 60112, 236780, 935848, 3708236, 14721912, 58533264, 232991656, 928261480, 3700935760, 14763921580, 58924038816, 235258847064, 939576469152, 3753419774180, 14997257109992, 59933657096280, 239547378220840
Offset: 0

Views

Author

Alois P. Heinz, Oct 03 2013

Keywords

Examples

			a(4) = 20 = 4! - 4, because 4 permutations of {1,...,4} do not satisfy the condition: 2314, 2341, 3214, 3241.
		

Crossrefs

Programs

  • Maple
    b:= proc(u, o) option remember; `if`(u+o=0, 1,
          add(b(sort([o-j, u+j-1])[]), j=1..min(2, o))+
          add(b(sort([u-j, o+j-1])[]), j=1..min(2, u)))
        end:
    a:= n-> `if`(n=0, 1, add(b(sort([j-1, n-j])[]), j=1..n)):
    seq(a(n), n=0..35);
  • Mathematica
    b[u_, o_] := b[u, o] = If[u+o == 0, 1, Sum[b[Sequence @@ Sort[{o-j, u+j-1}]], {j, 1, Min[2, o]}] + Sum[b[Sequence @@ Sort[{u-j, o+j-1}]], {j, 1, Min[2, u]}]]; a[n_] :=  If[n == 0, 1, Sum[b[Sequence @@ Sort[{j-1, n-j}]], {j, 1, n}]]; Table[a[n], {n, 0, 35}] (* Jean-François Alcover, Feb 05 2015, after Alois P. Heinz *)

Formula

a(n) ~ c * 4^n, where c = 0.052940679853652794231561081876002147090052503777... - Vaclav Kotesovec, Feb 23 2014
a(n) = Sum_{k=0..n-1} A356692(n-1,k) for n >= 1. - Alois P. Heinz, Aug 28 2022

A356832 Number of permutations p of [n] such that at most one element of {p(1),...,p(i-1)} is between p(i) and p(i+1) for all i < n and n = 0 or p(n) < 3.

Original entry on oeis.org

1, 1, 2, 4, 10, 26, 72, 206, 608, 1834, 5636, 17578, 55516, 177192, 570700, 1852572, 6055080, 19910730, 65823752, 218654100, 729459552, 2443051214, 8210993364, 27685671844, 93625082140, 317470233150, 1079183930828, 3676951654520, 12554734605496, 42952566314236
Offset: 0

Views

Author

Alois P. Heinz, Aug 30 2022

Keywords

Examples

			a(0) = 1: (), the empty permutation.
a(1) = 1: 1.
a(2) = 2: 12, 21.
a(3) = 4: 132, 231, 312, 321.
a(4) = 10: 1342, 1432, 2431, 3142, 3412, 3421, 4132, 4231, 4312, 4321.
a(5) = 26: 13542, 14532, 15342, 15432, 24531, 25431, 31542, 35142, 35412, 35421, 41532, 42531, 45132, 45231, 45312, 45321, 51342, 51432, 52431, 53142, 53412, 53421, 54132, 54231, 54312, 54321.
		

Crossrefs

Column k=0 and also main diagonal of A356692.

Programs

  • Maple
    b:= proc(u, o) option remember; `if`(u+o=0, 1,
          add(b(sort([o-j, u+j-1])[]), j=1..min(2, o))+
          add(b(sort([u-j, o+j-1])[]), j=1..min(2, u)))
        end:
    a:= n-> b(0, n):
    seq(a(n), n=0..30);
    # second Maple program:
    b:= proc(n, k) option remember; `if`(k<0 or k>n, 0,
          `if`(n=0, 1, add(b(n-1, j), j=k-2..k+1)))
        end:
    a:= n-> b(n, 0):
    seq(a(n), n=0..30);

Formula

a(n) = A356692(n,0) = A356692(n,n).
a(n) = 1 + A291683(n).
a(n) >= A102407(n) with equality only for n <= 7.

A356853 Number of permutations p of [2n+1] such that at most one element of {p(1),...,p(i-1)} is between p(i) and p(i+1) for all i <= 2n and p(2n+1) = n+1.

Original entry on oeis.org

1, 2, 20, 216, 2720, 36228, 503216, 7171404, 104142520, 1533200656, 22811374568, 342216338652, 5168324302672, 78483423004680, 1197266739443160, 18335055482658748, 281714880491273736, 4340894020114398672, 67055152953864109240, 1038097819961270208088
Offset: 0

Views

Author

Alois P. Heinz, Aug 31 2022

Keywords

Examples

			a(0) = 1: 1.
a(1) = 2: 132, 312.
a(2) = 20: 12453, 12543, 14253, 14523, 15243, 15423, 21453, 21543, 25143, 25413, 41253, 41523, 45123, 45213, 51243, 51423, 52143, 52413, 54123, 54213.
a(3) = 216: 1235764, 1236754, 1237564, 1237654, ..., 7651234, 7651324, 7652134, 7653124.
		

Crossrefs

Cf. A356692.

Programs

  • Maple
    b:= proc(u, o) option remember; `if`(u+o=0, 1,
          add(b(sort([o-j, u+j-1])[]), j=1..min(2, o))+
          add(b(sort([u-j, o+j-1])[]), j=1..min(2, u)))
        end:
    a:= n-> b(n$2):
    seq(a(n), n=0..20);
    # second Maple program:
    b:= proc(n, k) option remember; `if`(k<0 or k>n, 0,
          `if`(n=0, 1, add(b(n-1, j), j=k-2..k+1)))
        end:
    a:= n-> b(2*n, n):
    seq(a(n), n=0..20);

Formula

a(n) = A356692(2n,n).
Showing 1-3 of 3 results.