OFFSET
0,4
COMMENTS
a(n) is the number of cyclic permutations with at most two ascents. These permutations can also be characterized as admitting a [1, 1, 1]-gridding, meaning they are composed of three contiguous increasing segments.
LINKS
K. Archer and S. Elizalde, Cyclic permutations realized by signed shifts, Journal of Combinatorics, 5 (2014), 1-30.
I. M. Gessel and C. Reutenauer, Counting permutations with given cycle structure and descent set, J. Combin. Theory, Ser. A, 64, 1993, 189-215.
FORMULA
a(n) = L(3,n) - n*L(2,n) when n !== 2 (mod 4) and n>2;
a(n) = L(3,n) + L(3,n/2) - n*(L(2,n) + L(2,n/2)) when n == 2 (mod 4) and n>2;
where L(k,n) is the number of k-ary Lyndon words of length n.
PROG
(PARI) L2(n) = if(n>1, sumdiv(n, d, moebius(d)*2^(n/d))/n, n+1); \\ A001037
L3(n) = if(n<1, n==0, sumdiv(n, d, moebius(n/d)*3^d)/n); \\ A027376
a(n) = if (n <=2, 1, if ((n % 4) != 2, L3(n) - n*L2(n), L3(n) + L3(n/2) - n*(L2(n) + L2(n/2)))); \\ Michel Marcus, May 16 2018
CROSSREFS
KEYWORD
nonn
AUTHOR
Kassie Archer, May 07 2018
STATUS
approved