%I #17 Apr 26 2021 08:54:20
%S 1,1,2,4,16,20,32,56,148,136,186,328,894,868,1196,1896,5210,4936,6716,
%T 11264,30046,28168,38892,63272,169900,161848,218944,367616,966010,
%U 909192,1240738,2100064,5422442,5161412,7027750,11910404
%N Number of permutations p of [n] such that | |p(i) - p(i-1)| - |p(i+1) - p(i)| | = 1.
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Permutation">Permutation</a>
%p b:= proc(s, x, y) option remember; `if`(s={}, 1, add(
%p `if`(x=0 or y=0 or abs(abs(x-y)-abs(y-j))=1,
%p b(s minus {j}, y, j), 0), j=s))
%p end:
%p a:= n-> b({$1..n}, 0$2):
%p seq(a(n), n=0..20);
%t b[s_, x_, y_] := b[s, x, y] = If[s == {}, 1, Sum[
%t If[x == 0 || y == 0 || Abs[Abs[x - y] - Abs[y - j]] == 1,
%t b[s ~Complement~ {j}, y, j], 0], {j, s}]];
%t a[n_] := b[Range[n], 0, 0];
%t a /@ Range[0, 20] (* _Jean-François Alcover_, Apr 26 2021, after _Alois P. Heinz_ *)
%Y Cf. A338765.
%K nonn,more
%O 0,3
%A _Alois P. Heinz_, Nov 07 2020