TITLE: Some Combinatorics and Some Prime Numbers
QUESTION [7 upvotes]: Problem statement: Let $U=\{1,2,...n\}$ and $S$ be the set of all permutations of the elements of $U$. For any $f \in S$ let $I(f)$ denotes the number of inversions (see remark) of $f$. Let $A_j$ denotes the number of permutations $f$ in $S$ such that $I(f)\equiv j\pmod{p}$ $[0\leq j \leq p-1]$ where $p$ is an odd prime number. Then prove that $$A_1=A_2=A_3=\ldots=A_{p-1} \Leftrightarrow p\leq n.$$
My solution to this problem uses roots of unity (as I have posted the answer). I want to find other solutions.
Remark For a permutation $\sigma$ of $\{1,2,\ldots,n\}$ we call a pair $(i,j)$ an inversion in $\sigma$ if $i<j$ but $\sigma(i)>\sigma(j)$.

REPLY [4 votes]: @cha21 has a nice proof for the case when $p > n$, but for the $p \leq n$ there is an alternative approach for proof:
Claim: if $n \geq p$, then $A_0 = A_1 = ... A_{p-1}$
Proof: Let's define function $C_p(i)$ for permutation $p$ that counts number of inversions $(j, i)$ where $j < i$. More formally: $C_p(i) = |\{ j < i \mid p_j > p_i \}|$. 
Then, for every permutation $p$ we can define a sequence $C(p) = [C_p(0), C_p(1), ..., C_p(n - 1)]$. This sequence contained in the set of integer sequences $S(n)$ of length $n$, where $i$-th element of every sequence is in the set $[0..i]$, so $S(n) = \{ s \mid |s| = n \text{ and } \forall_i s_i \in [0..i] \}$ and $C(p) \in S(n)$. It's easy to see, that $|S(n)| = n!$ and therefore for any sequence $s \in S(n)$ there is exactly one permutation $p$ such that $C(p) = s$. 
Let's say that two sequences $a$ and $b$ from the set $S(n)$ equivalent iff $a$ and $b$ differs only at position $p-1$. This equivalence relation partition set $S(n)$ into the classes $K_i \subset S(n)$, and it's easy to see that $|K_i| = p$ and sequences from $K_i$ has $p$ different remainder of sum of values by module $p$. This implies, that $A_0 = A_1 = ... = A_{p-1}$.