OFFSET
1,3
COMMENTS
A finite sequence is normal if its union is an initial interval of positive integers.
LINKS
Andrew Howroyd, Rows n = 1..50 of triangle, flattened
Wikipedia, Lyndon word: Standard factorization
EXAMPLE
The T(3,2) = 5 normal sequences are {2,1,2}, {1,2,1}, {2,1,3}, {2,3,1}, {3,1,2}.
Triangle begins:
1;
1, 2;
4, 5, 4;
18, 31, 18, 8;
108, 208, 153, 56, 16;
778, 1700, 1397, 616, 160, 32;
6756, 15980, 14668, 7197, 2196, 432, 64;
MATHEMATICA
neckQ[q_]:=Array[OrderedQ[{q, RotateRight[q, #]}]&, Length[q]-1, 1, And];
aperQ[q_]:=UnsameQ@@Table[RotateRight[q, k], {k, Length[q]}];
qit[q_]:=If[#===Length[q], {q}, Prepend[qit[Drop[q, #]], Take[q, #]]]&[Max@@Select[Range[Length[q]], neckQ[Take[q, #]]&&aperQ[Take[q, #]]&]];
allnorm[n_]:=Function[s, Array[Count[s, y_/; y<=#]+1&, n]]/@Subsets[Range[n-1]+1];
Table[Length[Select[Join@@Permutations/@allnorm[n], Length[qit[#]]===k&]], {n, 5}, {k, n}]
PROG
(PARI) \\ here U(n, k) is A074650(n, k).
EulerMT(u)={my(n=#u, p=x*Ser(u), vars=variables(p)); Vec(exp( sum(i=1, n, substvec(p + O(x*x^(n\i)), vars, apply(v->v^i, vars))/i ))-1)}
U(n, k)={sumdiv(n, d, moebius(n/d) * k^d)/n}
A(n)={[Vecrev(p/y) | p<-sum(k=1, n, EulerMT(vector(n, n, y*U(n, k)))*sum(j=k, n, (-1)^(k-j)*binomial(j, k)))]}
{ my(T=A(10)); for(n=1, #T, print(T[n])) } \\ Andrew Howroyd, Dec 08 2018
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
Gus Wiseman, Dec 11 2017
EXTENSIONS
Example and program corrected by Gus Wiseman, Dec 08 2018
STATUS
approved