Finding for $p$ and $q$ being prime numbers all $p, q$ such that $1+\frac{p^q-q^p}{p+q}$ is prime I just came across the following question:
If $p$ and $q$ are prime numbers and $1+\frac{p^q-q^p}{p+q}$ is prime then find all $p$, and $q$ such that these conditions hold true.
I attempted to solve it in the following way:
\begin{align}
1+\frac{p^q-q^p}{p+q}&\equiv1+\frac{p}{q}\pmod q\\
&\equiv 2\pmod q
\end{align}
So we have that $\frac{p^q-q^p}{p+q}\equiv1 \pmod q$.
Then $\frac{p^q-q^p}{p+q}=1+qk$ for k integer.
$$
p^q-q^p=(1+qk)(p+k)\\
p^q-q^p=p+q+pqk+q^2k\\
1+\frac{p^q-q^p}{p+q}\equiv 1+\frac{-q}{q}\equiv0 \pmod p
$$
However we have that $1+\frac{p^q-q^p}{p+q}$ is a prime number.
So
\begin{align}
1+\frac{p^q-q^p}{p+q}&=p\\
p+q+p^q-q^p&=p^2+qp\\
p^q-q^p&=p^2+qp-p-q\\
2p+2q+qpk+q^2k-p^2-qp&=0\\
k(qp+q^2)+p(2-p)+q(2-p)&=0
\end{align}
From this we have that one of the solutions is:
$$k=0, p=2, q=5$$
It is enough if for $k\ge1$ it not to hold true.
And that is where I got stuck.
Could you please help me finish it off?
 A: Edit: The question is now for which primes $p,q$ the rational number $r$ as above is a prime. Just for fun - here are some examples where $r$ is at least an integer, for example for $(p,q)=(2,5),(3,79), (5,29),(7,139)\ldots $. We have
$$
(p,q)=(3,79) \Longrightarrow r=3^2\cdot 5\cdot 7\cdot 19\cdots 4283193922429
$$
$$
(p,q)=(5,29) \Longrightarrow r=5\cdot 11\cdot 59\cdot 67\cdot 10061\cdot 2504497231
$$
$$
(p,q)=(7,139) \Longrightarrow r=5\cdot 7^2\cdot 13\cdots 693835164612210146059549989728033
$$
In all examples we have that $5$ divides $r$, for $p>2$.
Of course we have $p\mid r$, as you have showed (I don't understand $p/q\bmod q$ in your notation), so that $r=p$. But then your last equation, for $k$ nonnegative, gives a sum of positive integers equal to zero for $p>2$. Hence $p=2$.
A: Let $r=1+\frac{p^q-q^p}{p+q}$ be prime, then $p\neq q$ and hence
$$p^q-q^p=(r-1)(p+q) \tag{*}$$
By Fermat's Little Theorem, $$-q \equiv (r-1)q \mod p$$
$$rq \equiv 0 \mod p$$
Hence, $p \mid r$ and since $r$ is prime,
$$\therefore p=r$$
Again by Fermat's Little Theorem and $r=p$, (*) becomes
$$p \equiv (p-1)p \mod q$$
$$2p \equiv p^2 \mod q$$
$$p \equiv 2 \mod p$$
$$\therefore q \mid p-2$$
Assume $p\neq 2$.
Since $p-2 \neq 0$, hence $q \leq p-2$, then $p^q-q^p=(p-1)(p+q)$ implies
$$p^q-q^p \equiv 0 \pmod{p-1}$$
$$\therefore q^p \equiv 1 \pmod{p-1}$$
Since $\phi(p-1) < p-1 < p$ and there exists $k=\text{ord}_{p-1} q$ such that $k \mid p$ and $k \mid \phi(p-1)$. Hence,
$$q \equiv 1 \pmod{p-1}$$
Then, $p-1 \mid q-1$, but $q \neq 1$, therefore $p-1<q-1$ or $p<q$. Contradicts the fact that $q\leq p-2$. Therefore $p=2$. Then (*) becomes
$$2^q-q^2=2+q$$
$$2^q=q^2+q+2$$
It is not hard to check that $q=5$ is the only solution since exponential growth is faster than quadratic growth.
Therefore, $(p,q)=(2,5)$ is the only solution.
