Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #12 Dec 29 2020 09:04:07
%S 1,1,1,5,31,246,2353,26585,345775,5094220,83833256,1524414737,
%T 30353430420,656851828075,15350023574061,385261255931365,
%U 10335781852020335,295166535640444376,8939894824857438940,286234265613041061128,9659753724363828753408
%N Number of up-down sequences of length n and values in {1,2,...,n}.
%H Alois P. Heinz, <a href="/A276312/b276312.txt">Table of n, a(n) for n = 0..413</a>
%F a(n) ~ exp(-1/2) * 2^(n+2) * n^n / Pi^(n+1). - _Vaclav Kotesovec_, Aug 30 2016
%e a(0) = 1: the empty sequence.
%e a(1) = 1: 1.
%e a(2) = 1: 12.
%e a(3) = 5: 121, 131, 132, 231, 232.
%e a(4) = 31: 1212, 1213, 1214, 1312, 1313, 1314, 1323, 1324, 1412, 1413, 1414, 1423, 1424, 1434, 2312, 2313, 2314, 2323, 2324, 2412, 2413, 2414, 2423, 2424, 2434, 3412, 3413, 3414, 3423, 3424, 3434.
%p b:= proc(n, k, t) option remember; `if`(n=0, 1,
%p add(b(n-1, k, k-j), j=1..t-1))
%p end:
%p a:= n-> b(n, n+1$2):
%p seq(a(n), n=0..25);
%t b[n_, k_, t_] := b[n, k, t] = If[n==0, 1, Sum[b[n-1, k, k-j], {j, 1, t-1}]];
%t a[n_] := b[n, n+1, n+1];
%t a /@ Range[0, 25] (* _Jean-François Alcover_, Dec 29 2020, after _Alois P. Heinz_ *)
%Y A diagonal of A050446, A050447.
%Y Cf. A276313.
%K nonn
%O 0,4
%A _Alois P. Heinz_, Aug 29 2016