Unofficial archive — problems, solutions & results © IMC, reproduced with permission.

IMC / 2016 / Problems / Day 1, P5

IMC 2016 · Day 1 · P5

killer

Let SnS_n denote the set of permutations of the sequence (1,2,,n)(1, 2, \dots, n). For every permutation π=(π1,,πn)Sn\pi = (\pi_1, \dots, \pi_n) \in S_n, let inv(π)\mathrm{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(π)\mathrm{inv}(\pi) is divisible by n+1n + 1.

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

(Proposed by Fedor Petrov, St. Petersburg State University)

Solution (official)

We will use the well-known formula πSnxinv(π)=1(1+x)(1+x+x2)(1+x++xn1).\sum_{\pi \in S_n} x^{\mathrm{inv}(\pi)} = 1 \cdot (1 + x) \cdot (1 + x + x^2) \dots (1 + x + \dots + x^{n-1}). (This formula can be proved by induction on nn. The cases n=1,2n = 1, 2 are obvious. From each permutation of (1,2,,n1)(1, 2, \dots, n-1), we can get a permutation of (1,2,,n)(1, 2, \dots, n) such that we insert the element nn at one of the nn possible positions before, between or after the numbers 1,2,,n11, 2, \dots, n-1; the number of inversions increases by n1,n2,,1n-1, n-2, \dots, 1 or 00, respectively.)

Now let Gn(x)=πSnxinv(π).G_n(x) = \sum_{\pi \in S_n} x^{\mathrm{inv}(\pi)}. and let ε=e2πin+1\varepsilon = e^{\frac{2\pi i}{n+1}}. The sum of coefficients of the powers divisible by n+1n + 1 may be expressed as a trigonometric sum as f(n)=1n+1k=0n1Gn(εk)=n!n+1+1n+1k=1n1Gn(εk).f(n) = \frac{1}{n+1} \sum_{k=0}^{n-1} G_n(\varepsilon^k) = \frac{n!}{n+1} + \frac{1}{n+1} \sum_{k=1}^{n-1} G_n(\varepsilon^k). Hence, we are interested in the sign of f(n)n!n+1=k=1n1Gn(εk)f(n) - \frac{n!}{n+1} = \sum_{k=1}^{n-1} G_n(\varepsilon^k) with n=p1n = p - 1 where pp is a (large, odd) prime.

For every fixed 1kp11 \le k \le p - 1 we have Gp1(εk)=j=1p1(1+εk+ε2k++ε(j1)k)=j=1p11εjk1εk=(1εk)(1ε2k)(1ε(p1)k)(1εk)p1.G_{p-1}(\varepsilon^k) = \prod_{j=1}^{p-1} (1 + \varepsilon^k + \varepsilon^{2k} + \dots + \varepsilon^{(j-1)k}) = \prod_{j=1}^{p-1} \frac{1 - \varepsilon^{jk}}{1 - \varepsilon^k} = \frac{(1 - \varepsilon^k)(1 - \varepsilon^{2k}) \cdots (1 - \varepsilon^{(p-1)k})}{(1 - \varepsilon^k)^{p-1}}. Notice that the factors in the numerator are (1ε)(1 - \varepsilon), (1ε2)(1 - \varepsilon^2), …, (1εp1)(1 - \varepsilon^{p-1}); only their order is different. So, by the identity (zε)(zε2)(zεp1)=1+z++zp1(z - \varepsilon)(z - \varepsilon^2) \dots (z - \varepsilon^{p-1}) = 1 + z + \dots + z^{p-1}, Gp1(εk)=p(1εk)p1=p(1e2kπip)p1.G_{p-1}(\varepsilon^k) = \frac{p}{(1 - \varepsilon^k)^{p-1}} = \frac{p}{\bigl( 1 - e^{\frac{2k\pi i}{p}} \bigr)^{p-1}}. Hence, f(p1)(p1)!pf(p-1) - \frac{(p-1)!}{p} has the same sign as k=1p1(1e2kπip)1p=k=1p1ek(1p)πip(2isinπkp)1p==221p(1)p12k=1p12cosπk(p1)p(sinπkp)1p.\begin{align*} \sum_{k=1}^{p-1} \bigl( 1 - e^{\frac{2k\pi i}{p}} \bigr)^{1-p} &= \sum_{k=1}^{p-1} e^{\frac{k(1-p)\pi i}{p}} \left( -2i \sin\frac{\pi k}{p} \right)^{1-p} = \\ &= 2 \cdot 2^{1-p} (-1)^{\frac{p-1}{2}} \sum_{k=1}^{\frac{p-1}{2}} \cos\frac{\pi k (p-1)}{p} \left( \sin\frac{\pi k}{p} \right)^{1-p}. \end{align*} For large primes pp the term with k=1k = 1 increases exponentially faster than all other terms, so this term determines the sign of the whole sum. Notice that cosπ(p1)p\cos\frac{\pi (p-1)}{p} converges to 1-1. So, the sum is positive if p1p - 1 is odd and negative if p1p - 1 is even. Therefore, for sufficiently large primes, f(p1)(n1)!pf(p-1) - \frac{(n-1)!}{p} is positive if p3(mod4)p \equiv 3 \pmod 4 and it is negative if p1(mod4)p \equiv 1 \pmod 4.

How the field did

contestants scored
314
average (of 10)
0.30
solved (≥ 80%)
2.2%
near-0 (≤ 10%)
95.9%
discrimination
0.29

Score distribution (field cohort)

Computed on contestants with a meaningful total (field cohort); discrimination is the corrected item–total correlation.

Similar problems

IMC 1999 · Day 2 · P12killeravg 0.4/10 · solved 2% · near-0 91% · disc 0.30
IMC 2025 · Day 1 · P5killeravg 1.0/10 · solved 5% · near-0 79% · disc 0.49
IMC 2016 · Day 2 · P8very hardavg 2.1/10 · solved 10% · near-0 62% · disc 0.38
IMC 2022 · Day 1 · P3very hardavg 2.3/10 · solved 12% · near-0 55% · disc 0.64