Find all the prime integer solutions to $q^2(p-1)=(p+1)(q+1)$ Let $p,q$ be prime numbers. Find all the integer solutions to:
$$q^2(p-1) = (p+1)(q+1)$$

I am almost sure that $q=2$,$p=7$ is the only solution. Thus I assumed that $p$ and $q$ were both odd to reach a contradiction, but so far I haven't made any progress that way.

$q^2(p−1)=(p+1)(q+1)$
This can be written as:
$\frac{q^2}{q+1} = \frac{p+1}{p-1} = 1 + \frac{2}{p-1}$
In other words, subtracting 1 from both sides,
$\frac{q^2 - q - 1}{q+1} = \frac{2}{p-1}$
Two cases here:
1) p = 2. So $q^2 - q - 1 = q+1$.
Gives: $q^2 - 2q - 2 = 0$. Easy to see this has no integer solutions (just solve the quadratic equation).
2) p is an odd prime. Let p = 2k + 1.
Then $q + 1 = k(q^2 - q - 1)$.
So $(q+1)(k+1) = kq^2$.
Now, q and q+1 are co-prime. So are k+1 and k. Unless k or q is 1, this can only mean:
$q+1 = k$ and $k+1 = q^2$
So $q+2 = q^2$
Solving the quadratic, q = 2 or q = -1. 'q is prime' makes us reject q = -1 case. So q = 2. So p = 2k+1 = 2(q+1) + 1 = 7.
Now, suppose k = 1. Then we get:
$2(q+1) = q^2$. This again gives $q^2 - 2q - 2 = 0$ which has no integer solutions.
q = 1 gives:
$2(k+1) = k$. This gives k = -1/2, which is not an integer.
So p = 7, q = 2 is the only solution to this.
