We will use the well-known formula
π∈Sn∑xinv(π)=1⋅(1+x)⋅(1+x+x2)…(1+x+⋯+xn−1).
(This formula can be proved by induction on n. The cases
n=1,2 are obvious. From each permutation of
(1,2,…,n−1), we can get a permutation of
(1,2,…,n) such that we insert the element n at one of
the n possible positions before, between or after the numbers
1,2,…,n−1; the number of inversions increases by
n−1,n−2,…,1 or 0, respectively.)
Now let
Gn(x)=π∈Sn∑xinv(π).
and let ε=en+12πi. The sum of
coefficients of the powers divisible by n+1 may be expressed as
a trigonometric sum as
f(n)=n+11k=0∑n−1Gn(εk)=n+1n!+n+11k=1∑n−1Gn(εk).
Hence, we are interested in the sign of
f(n)−n+1n!=k=1∑n−1Gn(εk)
with n=p−1 where p is a (large, odd) prime.
For every fixed 1≤k≤p−1 we have
Gp−1(εk)=j=1∏p−1(1+εk+ε2k+⋯+ε(j−1)k)=j=1∏p−11−εk1−εjk=(1−εk)p−1(1−εk)(1−ε2k)⋯(1−ε(p−1)k).
Notice that the factors in the numerator are
(1−ε), (1−ε2), …,
(1−εp−1); only their order is different. So, by
the identity
(z−ε)(z−ε2)…(z−εp−1)=1+z+⋯+zp−1,
Gp−1(εk)=(1−εk)p−1p=(1−ep2kπi)p−1p.
Hence, f(p−1)−p(p−1)! has the same sign as
k=1∑p−1(1−ep2kπi)1−p=k=1∑p−1epk(1−p)πi(−2isinpπk)1−p==2⋅21−p(−1)2p−1k=1∑2p−1cospπk(p−1)(sinpπk)1−p.
For large primes p the term with k=1 increases exponentially
faster than all other terms, so this term determines the sign of
the whole sum. Notice that cospπ(p−1) converges to
−1. So, the sum is positive if
p−1
is odd and negative if
p−1
is even. Therefore, for sufficiently large primes,
f(p−1)−p(n−1)!
is positive if p≡3(mod4) and it is negative if
p≡1(mod4).