Diophantine equation $a b=a+b+n$, find $(a,b)$ for particular $n$

115 Views Asked by At

It's easy to see that this equation always has a solution:

$$a=n+2,\quad b=2$$

Because it can be rewritten:

$$a=\frac{b+n}{b-1} \tag{1}$$

Moreover, for even $n$ there are no more nontrivial solutions, obviously, because we would have a ratio of odd to even or even to odd. (Never mind, that's not true, of course, even numbers can divide odd. However, there are other reasons for trouble with even $n$.)

I need to find solutions with minimal $a-b$, but $a \neq b$ for odd values of $n$. Is there a general formula or at least an algorithm?

Since $a$ and $b$ are interchangeable, assume $a >b$.

1

There are 1 best solutions below

4
On BEST ANSWER

We can rewrite this as $ab-a-b+1=n+1$, or $(a-1)(b-1)=n+1$. Hence the smallest $a-b$ is achieved then $a-1$ is the smallest divisor of $n+1$ greater than $\sqrt{n+1}$ (or equal if you were to allow $a=b$).

By the way, the ratio of even to odd can be integer - just look at $\frac{6}{3}$. For example, for $n=14$, you can take $a=6,b=4$, so this is another nontrivial solution for an even $n$.