4. Determine all pairs $(p, q), p, q \in \mathbb{N}$ such that

$$
(p+1)^{p-1}+(p-1)^{p+1}=q^{q}
$$
Solution. We have

$$
(p+1)^{p-1}+(p-1)^{p+1} \geq(p+1)^{p-1} \geq(p-1)^{p-1}
$$

$$
\begin{aligned}
(p+1)^{p-1}+(p-1)^{p+1} &>(p+1)^{p-1}+p^{p-1}(p-1) \\
& >p^{p-1}+p^{p-1}(p-1)=p^{p}
\end{aligned}
$$

Thus, when $p \geq 4, (p+1)^{p-1}+(p-1)^{p+1}=q^{q}$ has no solution in $\mathbb{N}$.

3) Let $q=p+1$

$$
\begin{aligned}
& (p+1)^{p-1}+(p-1)^{p+1}=(p+1)^{p+1} \Leftrightarrow \\
& (p-1)^{p+1}=(p+1)^{p-1}\left((p+1)^{2}-1\right) \Leftrightarrow \\
& (p-1)^{p+1}=(p+1)^{p-1} p(p+2)
\end{aligned}
$$

Since $p$ and $p-1$ are coprime, $(p+1)^{p-1}+(p-1)^{p+1}=(p+1)^{p+1}$ has no solution in $\mathbb{N}$.

Finally, the solutions to $(p+1)^{p-1}+(p-1)^{p+1}=q^{q}$ are

$$
(p, q)=(1,1) \text { and }(p, q)=(2,2) \text {. }
$$