Project Euler Problem 902

A permutation pi of 1, dots, n can be represented in one-line notation as pi(1),ldots,pi(n) .

Project Euler Problem 902

Solution

Answer: 343557869

Using a direct computation of the permutation powers and their lexicographic ranks modulo $10^9+7$, the required value is:

Answer: 343557869