# 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$$

Thanks

• I proved m+1=t2^s, n-1=q2^s with t, q are odd numbers But ... . Just that – tangkhaihanh Nov 5 '13 at 10:32
• what is $s$???? – user87543 Nov 5 '13 at 10:34
• Is $p$ prime ? ${}{}{}{}$ – Amr Nov 5 '13 at 10:34
• No, p is a positive number – tangkhaihanh Nov 5 '13 at 10:35
• @tangkhaihanh: This is true for any integer... – MichalisN Nov 5 '13 at 10:37

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)$

• "so one of x or y needs to be 1" must "x or z" ? – tangkhaihanh Nov 5 '13 at 11:15
• @tangkhaihanh: Yeah. Sorry for the notational difficulties here, I changed it while I was writing the answer. I hope my solution is correct but it's probably not the most elegant. – MichalisN Nov 5 '13 at 11:35
• Please consider and describe in addition case $(m,n)=(2^k\pm 1, 2^k\mp 1)$. then $(m+n)(mn+1) = 2^{3k+1}$, $k\in \mathbb{N}$. Examples: $$(1+3)(1\cdot 3 +1) = 2^4;$$ $$(3+5)(3\cdot 5 +1) = 2^7;$$ $$(7+9)(7\cdot 9 +1) = 2^{10};$$ $$(15+17)(15\cdot 17 +1) = 2^{13};$$ $$...$$ – Oleg567 Nov 5 '13 at 12:40
• @Oleg567, yes, i am wondering – tangkhaihanh Nov 5 '13 at 12:54
• @Oleg567: Thank you! I forgot one crucial case! I'll add it. – MichalisN Nov 5 '13 at 14:52