0%

Problem 720


Problem 720


Unpredictable Permutations

Consider all permutations of 1,2,N, listed in lexicographic order.
For example, for N=4, the list starts as follows:

(1,2,3,4) (1,2,4,3) (1,3,2,4) (1,3,4,2) (1,4,2,3) (1,4,3,2) (2,1,3,4) 

Let us call a permutation P unpredictable if there is no choice of three indices i<j<k such that P(i), P(j) and P(k) constitute an arithmetic progression.
For example, P=(3,4,2,1) is not unpredictable because P(1),P(3),P(4) is an arithmetic progression.

Let S(N) be the position within the list of the first unpredictable permutation.

For example, given N=4, the first unpredictable permutation is (1,3,2,4) so S(4)=3.
You are also given that S(8)=2295 and S(32)641839205(mod1 000 000 007).

Find S(225). Give your answer modulo 1 000 000 007.


不可预测的排列

考虑集合1,2,N的所有排列,并按字典序组成列表。
例如,对于N=4,所有排列组成的列表如下所示:

(1,2,3,4) (1,2,4,3) (1,3,2,4) (1,3,4,2) (1,4,2,3) (1,4,3,2) (2,1,3,4) 

对于排列P,如果不存在三个下标i<j<k使得P(i),P(j),P(k)构成等差数列,则称该排列为不可预测的
例如,P=(3,4,2,1)不是不可预测的,因为P(1),P(3),P(4)构成等差数列。

S(N)为在上述列表中第一个不可预测排列的位置。

例如,对于N=4,第一个不可预测排列是(1,3,2,4),因此S(4)=3
已知S(8)=2295S(32)641839205(mod1 000 000 007)

S(225),并将你的答案对1 000 000 007取余。


Gitalking ...