Finding all pairs of integer solutions to ${x^y = (x+y)^2}$

elementary-number-theorynumber theory

How do I find all solutions for ${x^y = (x+y)^2}$, where $x$ and $y$ are positive integers and at least one of them is prime.

For example, ${64 = 2^6 = (2+6)^2}$

A friend of mine pointed out that $x|y^2$ then $x^2|y^2$, so, when $x$ is prime and $y$ is not prime, we can write $y=xk$. Thus $x^{xk} = x^2 (1+k^2)$ and $x^{xk-2} = (1+k^2)$.

Best Answer

I'll ignore the "prime" requirement. It just spoils the fun. And I assume positive and negative integers.

x=0 is not possible. $0^y$ is only defined if $y>0$, but then $(0 + y)^2 > 0 = 0^y$.

If y < 0 then $x^y$ is not an integer unless $x = ±1$ and $x^y = ±1$. Since $x^y = (x+y)^2 ≥ 0$ we must have $x^y = +1$ and $x+y = ± 1$. $x = -1$ is not possible because it makes $x + y ≤ -2$ and $(x+y)^2 ≥ 4$. $x=1$ implies $x+y = ±1$, therefore $y=0$ or $y=-2$, so $1^{-2} = (1-2)^2 = 1$ is the only solution with $y<0$.

If $y=0$ then $x^y = 1$, so $(x+0)^2 = 1$ so $x = ±1$. ${±1}^0 = (±1 + 0)^2 = 1$.

If $y=1$ then $x^y = x = (x+1)^2$. We must have $x>0$, and any $x > 0$ is less than $(x+1)^2$, so no solution.

If $y=2$ then $x^y = x^2 = (x+2)^2$, so $x + 2 = ±x$. This is the case only for x = -1, y = 2: ${-1}^2 = (-1 + 2)^2 = 1$.

If $x = ±1$ then $x^y$ must be 1, so $x+y = ±1$. Not possible with $y ≥ 3$.

If $y ≥ 3$ and $|x| ≥ 2$ then $x^y$ grows faster than $(x + y)^2$; the only values where $(x+y)^2 ≥ x^y$ are:

$2^3 = 8 < 25 = (2+3)^2$
$2^4 = 16 < 36 = (2+4)^2$
$2^5 = 32 < 49 = (2+5)^2$
$2^6 = 64 = 64 = (2+6)^2$
$3^3 = 27 < 36 = (3+3)^2$

and the only solution is $2^6 = (2+6)^2 = 64$.

Summary: The only solutions with positive or negative integers are $1^{-2} = (1-2)^2 = 1$, $1^0 = (1+0)^2 = 1$, ${-1}^0 = (-1 + 0)^2 = 1$, ${-1}^2 = (-1 + 2)^2 = 1$, and $2^6 = (2+6)^2 = 64$.