|
例子
|
a(1)=1到a(4)=10正常序列:
(1) (2,1) (2,1,1) (2,1,1,1)
(2,2,1) (2,2,1,1)
(3,2,1) (2,2,2,1)
(3,1,2,1)
(3,2,1,1)
(3,2,2,1)
(3,2,3,1)
(3,3,2,1)
(4,2,3,1)
(4,3,2,1)
|
|
数学
|
lynQ[q_]:=长度[q]==0||数组[Union[{q,RotateRight[q,#1]}]=={q,RotateRight[q,#1]}&,长度[q]-1,1,And];
colynQ[q_]:=Length[q]==0||数组[Union[{RotateRight[q,#],q}]=={Rotate Right[q,#],q{&,Length[1,1,And];
allnorm[n_]:=如果[n<=0,{{}},函数[s,数组[Count[s,y_/;y<=#]+1&,n]]/@子集[Range[n-1]+1]];
表[Length[Select[Join@@Permutations/@allnorm[n],lynQ[Reverse[#]]&&colynQ[#]&]],{n,0,6}]
|