Prove that $\prod_{i
We are given $2017$ prime numbers $p_1,p_2,\ldots,p_{2017}$. Prove that  $\displaystyle \prod_{i<j} (p_i^{p_j}-p_j^{p_i})$ is divisible by $5777$.
Note that $5777 = 53 \cdot 109$. We first consider $p_i^{p_j}-p_j^{p_i}$ modulo $53$. We are to prove that \begin{align*}p_i^{p_j} \equiv p_j^{p_i} \pmod{53} \quad \tag{1}\end{align*} for some primes $p_i,p_j$.There exist primes in the list such that $p_i = 53k_1+d,p_j = 53k_2+d$, where $0 \leq d \leq 52$ and $k_1,k_2 > 0$. Then $(1)$ is equivalent to $$d^{53k_1} \equiv d^{53k_2} \pmod{53} \iff d^{53(k_1-k_2)} \equiv 1 \pmod{53}.$$ Now since $53$ is odd, $k_1,k_2$ must be only odd or only even. Then note there are at least $2017-15 = 2002$ such primes $p_i,p_j$ because there are $28$ primes between $0$ and $53$. Therefore, since $\left\lceil\dfrac{2002}{53}\right\rceil = 39$, there exist $p_i,p_j$ such that $k_1 \equiv k_2 \pmod{26}$ and $k_1$ and $k_2$ have the same parity quotient upon division by $26$ and $k_1 > k_2$. Therefore, $$52 \mid 53(k_1-k_2)$$ and so we have found primes $p_i,p_j$ that satisfy $(1)$.
I tried proving divisibility by $109$ using the same argument, but it didn't work:
Now we consider modulo $109$. We are to prove that \begin{align*}p_i^{p_j} \equiv p_j^{p_i} \pmod{109} \quad \tag{2}\end{align*} for some primes $p_i,p_j$. primes in the list such that $p_i = 109m_1+d_1,p_j = 109m_2+d_1$, where $0 \leq d_1 \leq 108$ and $m_1,m_2 > 0$. Then $(2)$ is equivalent to $$d_1^{109m_1} \equiv d_1^{109m_2} \pmod{109} \iff d_1^{109(m_1-m_2)} \equiv 1 \pmod{109}.$$ Now since $109$ is odd, $m_1,m_2$ must be only odd or only even. Then note there are at least $2017-28 = 1989$ such primes $p_i,p_j$ because there are $28$ primes between $0$ and $109$. Therefore, $\left\lceil\dfrac{1989}{109}\right\rceil = 19$.
Is it possible to use the same argument to prove divisibility by $109$?
 A: It seems like there are too many pigeons in this problem. We can assume that all the $p_i$ are distinct otherwise for $p_i=p_j, i<j$ the product in question is $0$ hence a multiple of $5777$.
In particular, the idea is to see when two primes $p,q$ satisfy $53 | p^q-q^p$ and $109 | p^q-q^p$ respectively, then transform this accordingly into an argument which allows the use of pigeonhole principle.
Eveerything the OP has done for $53$ fails for $109$ because the problem is that the number of pigeonholes isn't constrained enough while the number of pigeons stays the same.
The idea for both $53$ and $109$ seems to be the following. Suppose, without loss of generality that $p,q$ are two primes such that $p,q$ do not divide $108$ or $109$. In that case, $p,q$ are coprime to $108$ and by Bezout's lemma , we can find non-negative $p',q'$ such that $$pp' \equiv qq' \equiv 1 \pmod{108}$$
Once this is done, then for such $p,q$ as above, the following implication
holds : $$
p^{p'} \equiv q^{q'} \pmod{109} \implies p^q \equiv q^p \pmod{109}
$$
Indeed, begin with primes $p,q$ coprime to $108,109$ such that $p^{p'} \equiv q^{q'} \pmod{109}$. Then, raise both sides to the power $pq$ to get $$
p^{p'pq} \equiv q^{q'qp} \pmod{109} \tag{1} \label{1}
$$
However, by Fermat's little theorem, $p^{108} \equiv 1 \pmod{109}$ because $p \neq 109$. Similarly, $p^{108k+1} \equiv p \pmod{109}$ for any $k \geq 1$. In particular, as $pp' = 108k+1$ for some $k \geq 1$,
$$
p^{p'p} \equiv p \pmod{109} \implies p^{p'pq} \equiv p^q \pmod{109}
$$
Repeating this with $q$ tells us that $q^{q'qp} \equiv q^p \pmod{109}$. Going back to \eqref{1}, we get to $p^q \equiv q^p \pmod{109}$, as desired.
Therefore, we are reduced to merely looking at $p_i^{p_i'}$ for all $i$ such that $p_i$ is coprime to all of $52,53,108$ and $109$. That's just the primes $2,3,13,53,109$, so taking these out we have at least $2012$ primes to work with.

Taking those out, we have $2012$ pigeons, which are $p_i^{p_i'}$ for $i=1,\ldots,2012$. We have only $109$ pigeonholes which are remainders of these quotients modulo $109$. By PHP we can find $i<j$ such that $p_i^{p_{i}'} \equiv p_j^{p_j'} \pmod{109}$. As $p_i,p_j \neq 2,3,13,53,109$, it follows that $p_i^{p_j} \equiv p_j^{p_i} \pmod{109}$ for this choice of $i$ and $j$.
For a possible different choice of $i$ and $j$, but with $53$ instead of $109$, we will get that some $i<j$ exist such that $p_i^{p_j} \equiv p_j^{p_i} \pmod{53}$.
As $5777 = 109 \times 53$ is the product of these two primes, it follows that $5777$ is also a multiple of the product. However, $2017$ seems like an unusually large number of pigeons and it almost seems bewildering to have so many unnecessary pigeons in a "tough" PHP problem. I can't see anything wrong with my solution immediately, though.
A: Hint: Among the 2017 primes, there are a pair which is same modulo 53 and another pair which is same modulo 109.
Edit: Even if $p_i$ equals $p_j$ modulo 53, we don't know if $p_i^{p_j}-p_j^{p_i}$ is divisible by 53.
A: We can simplify Sarvesh's approach to proving the following:

Given $n+1$ integers $a_i$, then there is some $i, j$ such that $ n \mid (a_i - a_j)$.

Proof: Consider the remainders of $a_i \pmod{n}$. Since there are $n+1$ terms, and $n$ possible remainders, by PHP 2 of them are the same. Hence $ n \mid a_i - a_j$.

Now apply this to $n = 53,$ (resp 109).
If any of the $p_i = 53, 109$, let's ignore them.
Let $a_i = {p_i} ^ { 1/p_i}$, where the rational exponent is interpreted mod 53 (resp 109) so we have an integer. These exist and are well defined in prime modulus as they have a generator.
Then, by the above, there is some $i,j$ such that $p_i^{1/p_i} \equiv p_j ^{1/p_j} \pmod{53}$. Raising the expoenets by $p_i p_j$, we get that $ p_i^{p_j} \equiv p_j^{p_i} \pmod{53}$.
Hence, we only need 112 prime numbers to draw the conclusion.
Note: To extend this to all integers

*

*We exclude multiples of 53 (resp 109). However, if there are 2 or more such multiples, then clearly $ p_i^{p_j} - p_j^{p_i}$ is a multiple of 53.

*The rest hold, and so we do only need 112 integers.

