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.

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.

This page as a plain text file.
%I A216837 #24 Aug 29 2022 10:23:09
%S A216837 1,1,2,6,20,72,268,1020,3936,15332,60112,236780,935848,3708236,
%T A216837 14721912,58533264,232991656,928261480,3700935760,14763921580,
%U A216837 58924038816,235258847064,939576469152,3753419774180,14997257109992,59933657096280,239547378220840
%N 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.
%H A216837 Alois P. Heinz, <a href="/A216837/b216837.txt">Table of n, a(n) for n = 0..1000</a>
%F A216837 a(n) ~ c * 4^n, where c = 0.052940679853652794231561081876002147090052503777... - _Vaclav Kotesovec_, Feb 23 2014
%F A216837 a(n) = Sum_{k=0..n-1} A356692(n-1,k) for n >= 1. - _Alois P. Heinz_, Aug 28 2022
%e A216837 a(4) = 20 = 4! - 4, because 4 permutations of {1,...,4} do not satisfy the condition: 2314, 2341, 3214, 3241.
%p A216837 b:= proc(u, o) option remember; `if`(u+o=0, 1,
%p A216837       add(b(sort([o-j, u+j-1])[]), j=1..min(2, o))+
%p A216837       add(b(sort([u-j, o+j-1])[]), j=1..min(2, u)))
%p A216837     end:
%p A216837 a:= n-> `if`(n=0, 1, add(b(sort([j-1, n-j])[]), j=1..n)):
%p A216837 seq(a(n), n=0..35);
%t A216837 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_ *)
%Y A216837 Cf. A174700, A174701, A174702, A174703, A174704, A174705, A174706, A174707, A174708, A185030, A356692.
%K A216837 nonn
%O A216837 0,3
%A A216837 _Alois P. Heinz_, Oct 03 2013