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.
%I A356832 #20 Sep 03 2022 22:09:43 %S A356832 1,1,2,4,10,26,72,206,608,1834,5636,17578,55516,177192,570700,1852572, %T A356832 6055080,19910730,65823752,218654100,729459552,2443051214,8210993364, %U A356832 27685671844,93625082140,317470233150,1079183930828,3676951654520,12554734605496,42952566314236 %N 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. %H A356832 Alois P. Heinz, <a href="/A356832/b356832.txt">Table of n, a(n) for n = 0..1802</a> %F A356832 a(n) = A356692(n,0) = A356692(n,n). %F A356832 a(n) = 1 + A291683(n). %F A356832 a(n) >= A102407(n) with equality only for n <= 7. %e A356832 a(0) = 1: (), the empty permutation. %e A356832 a(1) = 1: 1. %e A356832 a(2) = 2: 12, 21. %e A356832 a(3) = 4: 132, 231, 312, 321. %e A356832 a(4) = 10: 1342, 1432, 2431, 3142, 3412, 3421, 4132, 4231, 4312, 4321. %e A356832 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. %p A356832 b:= proc(u, o) option remember; `if`(u+o=0, 1, %p A356832 add(b(sort([o-j, u+j-1])[]), j=1..min(2, o))+ %p A356832 add(b(sort([u-j, o+j-1])[]), j=1..min(2, u))) %p A356832 end: %p A356832 a:= n-> b(0, n): %p A356832 seq(a(n), n=0..30); %p A356832 # second Maple program: %p A356832 b:= proc(n, k) option remember; `if`(k<0 or k>n, 0, %p A356832 `if`(n=0, 1, add(b(n-1, j), j=k-2..k+1))) %p A356832 end: %p A356832 a:= n-> b(n, 0): %p A356832 seq(a(n), n=0..30); %Y A356832 Column k=0 and also main diagonal of A356692. %Y A356832 Cf. A000142, A102407, A216837, A291683. %K A356832 nonn %O A356832 0,3 %A A356832 _Alois P. Heinz_, Aug 30 2022