<s>[INST] Solution Of Diophantine Equations. Find all positive integers $x$ and $y$ such that $(x+y)(xy+1)=2^z$
Now as $2$ is a prime number we get $x+y=2^a$ and $xy+1=2^b$ for some natural numbers $a$ and $b$. Now as $xy+1>x+y$ for every $x, y>1$. So we get $2^b>2^a=> b>a=> 2^a|2^b$. So $x+y|xy+1$. Now let $p$ be a common prime factor of $x$ and $y$, then $p$ divides $x+y$, so $p$ divides $xy+1$ but as $p$ divides $x$ and $y$ so $p$ divides $xy$. So we get $p$ divides $1$, so there is no common factor of $x$ and $y$.
Now what i do from here?
 [/INST] You have $xy=2^k-1$ for some integer $k> 0$
Note that with $x=1$ and $y=2^k-1$ you get $$(x+y)(xy+1)=2^{2k}$$
So we always have that solution. 
We also have other solutions if we can factor $2^k-1$ into two integers whose sum is a power of $2$ 
For example with $k=4$ we get $2^{k}-1=3(5)$ where $3+5=2^3$  so $(x+y)(xy+1)=2^{7}$
</s>