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 A338765 #18 Mar 21 2022 04:46:37 %S A338765 1,1,2,6,18,38,76,162,330,650,1272,2586,5262,10506,20856,41928,83684, %T A338765 165800,329310,653614,1303388,2584660,5139580,10210912,20288128, %U A338765 40224174,79824572,158316222,314272812 %N A338765 Number of permutations p of [n] such that | |p(i) - p(i-1)| - |p(i+1) - p(i)| | <= 1. %H A338765 Wikipedia, <a href="https://en.wikipedia.org/wiki/Permutation">Permutation</a> %p A338765 b:= proc(s, x, y) option remember; `if`(s={}, 1, add( %p A338765 `if`(x=0 or y=0 or abs(abs(x-y)-abs(y-j))<=1, %p A338765 b(s minus {j}, y, j), 0), j=s)) %p A338765 end: %p A338765 a:= n-> b({$1..n}, 0$2): %p A338765 seq(a(n), n=0..15); %t A338765 b[s_, x_, y_] := b[s, x, y] = If[s == {}, 1, Sum[ %t A338765 If[x == 0 || y == 0 || Abs[Abs[x - y] - Abs[y - j]] <= 1, %t A338765 b[s ~Complement~ {j}, y, j], 0], {j, s}]]; %t A338765 a[n_] := b[Range[n], 0, 0]; %t A338765 a /@ Range[0, 15] (* _Jean-François Alcover_, Apr 26 2021, after _Alois P. Heinz_ *) %Y A338765 Cf. A295370, A338766. %K A338765 nonn,more %O A338765 0,3 %A A338765 _Alois P. Heinz_, Nov 07 2020