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 A338738 #15 Sep 08 2021 12:40:02 %S A338738 1,1,2,4,6,8,10,14,20,24,32,40,48,70,94,126,162,228,292,386,528,710, %T A338738 956,1298,1730,2342,3178,4192,5684,7720,10340,14002,18816,25372,34054 %N A338738 Number of permutations p of [n] such that |p(i) - p(i-1)| <= |p(i+1) - p(i)|. %H A338738 Wikipedia, <a href="https://en.wikipedia.org/wiki/Permutation">Permutation</a> %e A338738 a(4) = 6: 1234, 2314, 2341, 3214, 3241, 4321. %p A338738 b:= proc(s, x, y) option remember; `if`(s={}, 1, add( %p A338738 `if`(x=0 or y=0 or abs(x-y)<=abs(y-j), %p A338738 b(s minus {j}, y, j), 0), j=s)) %p A338738 end: %p A338738 a:= n-> b({$1..n}, 0$2): %p A338738 seq(a(n), n=0..16); %t A338738 b[s_, x_, y_] := b[s, x, y] = If[s == {}, 1, Sum[If[x == 0 || y == 0 || Abs[x - y] <= Abs[y - j], b[s ~Complement~ {j}, y, j], 0], {j, s}]]; %t A338738 a[n_] := b[Range[n], 0, 0]; %t A338738 Table[Print[n, " ", a[n]]; a[n], {n, 0, 20}] (* _Jean-François Alcover_, Sep 08 2021, after _Alois P. Heinz_ *) %Y A338738 Cf. A338614. %K A338738 nonn,more %O A338738 0,3 %A A338738 _Alois P. Heinz_, Nov 05 2020 %E A338738 a(27)-a(34) from _Bert Dobbelaere_, Nov 15 2020