An array P = [$p_1$, $p_2$, ..., $p_n$] is a “n-permutation”, if and only if all pi are in [1, n] and distinct.
For a n-permutation P, we define a transform function F on P: F(X) = [$X_{p_1}$, $X_{p_2}$, ..., $X_{p_n}$]. The result is obviously also a n-permutation.
It is not hard to find that if we apply F on P repeatedly, the result will be same as the original P at certain time. Formally, we define $F^0$(X) = X, and $F^{i+1}$(X) = F($F^i$(X)), then we use G(P) to represent
the minimum positive number which satisfy $F^{G(P)}$(X) == X. (Two n-permutations are equal (“==”), ifand only if their corresponding elements are equal. )
Among all n! different n-permutations, how many distinct values of G are there?