Unpredictable Permutations
Consider all permutations of , listed in lexicographic order.
For example, for , the list starts as follows:
Let us call a permutation unpredictable if there is no choice of three indices such that , and constitute an arithmetic progression.
For example, is not unpredictable because is an arithmetic progression.
Let be the position within the list of the first unpredictable permutation.
For example, given , the first unpredictable permutation is so .
You are also given that and .
Find . Give your answer modulo .
不可预测的排列
考虑集合的所有排列,并按字典序组成列表。
例如,对于,所有排列组成的列表如下所示:
对于排列,如果不存在三个下标使得构成等差数列,则称该排列为不可预测的。
例如,不是不可预测的,因为构成等差数列。
记为在上述列表中第一个不可预测排列的位置。
例如,对于,第一个不可预测排列是,因此。
已知,。
求,并将你的答案对取余。
Gitalking ...