How can one find all integer solutions to $x^y-y^x=k$, for a given k?

Example case $x^y-y^x=11$


Solution 1:

The numbers $x^y - y^x$ blow up when $x$ and $y$ get large. Besides the trivial solutions of the form $(k+1, 1)$ the only values of $k < 1000$ giving solutions are:

$$\begin{align} 3^2 - 2^3 &= 1 \\ 2^5 - 5^2 &= 7 \\ 3^4 - 4^3 &= 17 \\ 2^6 - 6^2 &= 28 \\ 2^7 - 7^2 &= 79 \\ 3^5 - 5^3 &= 118 \\ 2^8 - 8^2 &= 192 \\ 4^5 - 5^4 &= 399 \\ 2^9 - 9^2 &= 431 \\ 3^6 - 6^3 &= 513 \\ 2^{10} - 10^2 &= 924 \end{align}$$

For a small theoretical analysis, suppose $x < y$ (if $x > y$, the result is negative). Then $y^x = x^x (1 + \frac{y - x}{x})^x < x^x e^{y-x}$, so $$x^y - y^x \geq x^x (x^{y-x} - e^{y-x}).$$ So for $x \geq 3$ this blows up enormously. So for small $k$, only small values of $x$ and $y$ are possible.