How can $p^{q+1}+q^{p+1}$ be a perfect square? How can one find all primes $(p,q)$  such that $p^{q+1}+q^{p+1}$ is a perfect square 
I considered it $\mod 2$ and found a trival solution .
Im curious about an eventual answer Diophantine equations are extremely hard.
This seems harder than IMO Q2 of this year .
edit1:
I think one should consider it $\mod 4$ . 
 A: Claim: $(p,q)=(2,2)$ is the only pair of prime solutions.
Proof. 
Consider $$ p^{q+1} + q^{p+1} = n^2.$$
With $(p,q)=(2,3),(3,2)$ the LHS equals $43$, a prime number itself.
With $(p,q)=(3,3)$ it equals $2\cdot3^4$, which obviously is not a square as the exponent of $2$ is odd.
With one equal to $2$ and the other $\ge29$, say respectively $p$ and $q$, it is not a square because $$\left(2^{\frac{q+1}{2}}\right)^2<2^{q+1}+q^3<2^{q+1}+2^{\frac{q+3}{2}}+1=\left(2^{\frac{q+1}{2}}+1\right)^2;$$
one can rule out $5\le q < 29$ by trial and error.
Suppose there exist solutions with $p,q\ge5$. They are respectively equal to $6a\pm1$ and $6b\pm1$, for some positive integers $a,b$, so substituting for each of the four cases we have $$\begin{align}(6a+1)^{6b+2}+(6b+1)^{6a+2}&=n^2 \\ \left((6a+1)^{3b+1}\right)^{2}+\left((6b+1)^{3a+1}\right)^{2}&=n^2 \tag{1}\end{align}$$ or $$ \begin{align}(6a-1)^{6b+2}+(6b+1)^{6a}&=n^2 \\ \left((6a-1)^{3b+1}\right)^{2}+\left((6b+1)^{3a}\right)^{2}&=n^2 \tag{2}\end{align}$$ or  $$\begin{align} (6a+1)^{6b}+(6b-1)^{6a+2}&=n^2 \\ \left((6a+1)^{3b}\right)^{2}+\left((6b-1)^{3a+1}\right)^{2}&=n^2 \tag{3}\end{align}$$ or $$\begin{align}(6a-1)^{6b}+(6b-1)^{6a}&=n^2 \\ \left((6a-1)^{3b}\right)^{2}+\left((6b-1)^{3a}\right)^{2}&=n^2. \tag{4}\end{align}$$
All of them are pithagorean identities, and as such, one and only one of the numbers squared in their LHS is odd. But each one of them is a power of an odd number, hence an odd number itself. Thus we have a contradiction, and the claim is proved. $ \ \ \ \ \ \ \ \ \ \ \  \text{QED}$
A: First of all, note that $n^2\equiv 0,1\pmod 3$ for every $n\in\mathbb Z$.
Let us separate it into cases : 


*

*For $p\equiv q\equiv 0\pmod 3$, having $p=q=3$ leads $3^4+3^4=162$ which is not a perfect square.

*For $p\equiv 0,q\not\equiv 0\pmod 3$, having $3^{q+1}+q^{3+1}=m^2$ leads $3^{q+1}=(m-q^2)(m+q^2)$. Thus we have $m-q^2=3^s,m+q^2=3^t$ where $0\le s\le t$, so adding these gives $2m=3^s+3^t$. Here suppose that $1\le s$, then $m\equiv 0\pmod 3$, so $q\equiv 0\pmod 3$ which contradicts $q\not\equiv 0\pmod 3$. Hence, we have $s=0,t=q+1$. Thus, we have $3^{q+1}-2q^2=1$ which has no positive integer solution. 

*For $p\equiv 1,q\not\equiv 0\pmod 3$, $p^{q+1}+q^{p+1}\equiv 2$, so this cannot be a perfect square.

*For $p\equiv q\equiv 2\pmod 3$, if $p=q=2$, then $2^3+2^3=4^2$. For odd $p,q$, there exist $s,t$ such that $p=6s-1,q=6t-1$. Then, $p^{q+1}+q^{p+1}\equiv (-1)^{6t}+(-1)^{6s}\equiv 2\pmod 3$ which cannot be a perfect square.
Hence, $p=q=2$ is the only solution.
