Find all positive integers m, n, p such that $(m+n)(mn+1)=2^p$ Find all positive integers m, n, p such that  
$$(m+n)(mn+1)=2^p$$
Please give me some hints
Thanks

We have $m+n=2^a$ and $mn+1=2^b$ with $a+b=p$. First note that both $m$ and $n$ need to be odd.
First case: Suppose $m=1$ or $n=1$, then the other is equal to $2^{p/2}-1$  and this is a solution for even $p$.
Now suppose $m>1$ so $b>a>1$. Adding the two equations above we get
$(m+1)(n+1)=mn+1+m+n=2^a(2^{b-a}+1)$. Let $m+1=2^xw$ and $n+1=2^zy$ with $w,y$ odd, $x,z>0$ and $x+z=a$. Then $2^a=2^xw+2^zy-2$, so one of $x$ or $z$ needs to be $1$ (if both were $>1$ the RHS would be $\equiv 2\mod 4$.
Case $x=1$: We have $x+z=a$, so $z=a-1$. The equation for $2^a$ becomes
$$
2^a=2w+2^{a-1}y-2\geq 2^{a-1}y.
$$
This implies $y=1$, since it is odd. We get $m-1=2w-2=2^{a-1}$ and $n+1=2^z=2^{a-1}$ and indeed this gives a solution.
Case $z=1$: The same just with $m$ and $n$ swapped. 
So the only solutions are $m=1$ and $y=2^{p/2}-1$ and 
$(m,n)=(2^k\pm 1,2^k\mp 1)$
