IMC 2016 · Problem 5

Day 123rd IMC · Blagoevgrad, Bulgaria

Statement

Let SnS_n denote the set of permutations of the sequence (1,2,,n)(1, 2, \ldots, n). For every permutation π=(π1,,πn)Sn\pi = (\pi_1, \ldots, \pi_n) \in S_n, let inv(π)\operatorname{inv}(\pi) be the number of pairs 1i<jn1 \le i < j \le n with πi>πj\pi_i > \pi_j; i.e. the number of inversions in π\pi. Denote by f(n)f(n) the number of permutations πSn\pi \in S_n for which inv(π)\operatorname{inv}(\pi) is divisible by n+1n + 1.

Prove that there exist infinitely many primes pp such that f(p1)>(p1)!pf(p - 1) > \dfrac{(p-1)!}{p}, and infinitely many primes pp such that f(p1)<(p1)!pf(p - 1) < \dfrac{(p-1)!}{p}.

Official solution

Hidden so you can work on the problem first.

Proposed by Fedor Petrov, St. Petersburg State University.