# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/
Search: id:a249583
Showing 1-1 of 1
%I A249583 #23 Sep 03 2021 01:51:22
%S A249583 1,1,1,2,5,9,40,169,477,3194,19241,74601,666160,5216485,25740261,
%T A249583 287316122,2769073949,16591655817,222237912664,2543467934449,
%U A249583 17929265150637,280180369563194,3712914075133121,30098784753112329,537546603651987424,8094884285992309261
%N A249583 Number of permutations p of [n] such that p(i) > p(i+1) iff i == 2 (mod 3).
%C A249583 This is the (UDU)* version of 3-alternating permutations of [n], (U=Up, D=Down).
%H A249583 Alois P. Heinz, Table of n, a(n) for n = 0..500
%H A249583 J. M. Luck, On the frequencies of patterns of rises and falls, arXiv:1309.7764, 2013
%H A249583 Anthony Mendes and Jeffrey Remmel, Generating functions from symmetric functions, Preliminary version of book, available from Jeffrey Remmel's home page
%H A249583 R. P. Stanley, A survey of alternating permutations, arXiv:0912.4240, 2009
%e A249583 a(2) = 1: 12.
%e A249583 a(3) = 2: 132, 231.
%e A249583 a(4) = 5: 1324, 1423, 2314, 2413, 3412.
%e A249583 a(5) = 9: 13245, 14235, 15234, 23145, 24135, 25134, 34125, 35124, 45123.
%e A249583 a(6) = 40: 132465, 132564, 142365, 142563, 143562, 152364, 152463, 153462, 162354, 162453, 163452, 231465, 231564, 241365, 241563, 243561, 251364, 251463, 253461, 261354, 261453, 263451, 341265, 341562, 342561, 351264, 351462, 352461, 361254, 361452, 362451, 451263, 451362, 452361, 461253, 461352, 462351, 561243, 561342, 562341.
%e A249583 a(7) = 169: 1324657, 1324756, 1325647, ..., 6723514, 6724513, 6734512.
%p A249583 b:= proc(u, o, t) option remember; `if`(u+o=0, 1,
%p A249583 `if`(t=2, add(b(u-j, o+j-1, irem(t+1, 3)), j=1..u),
%p A249583 add(b(u+j-1, o-j, irem(t+1, 3)), j=1..o)))
%p A249583 end:
%p A249583 a:= n-> b(0, n, 0):
%p A249583 seq(a(n), n=0..35);
%t A249583 b[u_, o_, t_] := b[u, o, t] = If[u + o == 0, 1, If[t == 2, Sum[b[u - j, o + j - 1, Mod[t+1, 3]], {j, 1, u}], Sum[b[u + j - 1, o - j, Mod[t+1, 3]], {j, 1, o}]]];
%t A249583 a[n_] := b[0, n, 0];
%t A249583 Table[a[n], {n, 0, 35}] (* _Jean-François Alcover_, Nov 06 2017, after _Alois P. Heinz_ *)
%Y A249583 Cf. A178963 (i=0), A249402 (i=1).
%K A249583 nonn
%O A249583 0,4
%A A249583 _Alois P. Heinz_, Nov 01 2014
# Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE