0

How to find all integer solutions for the equation

$y = \frac{a+bx}{b-x}$, where a and b are known integer values?

P.S. x and y must be integer at the same time

Jean Marie
  • 81,803

1 Answers1

2

First multiply denominator to other side : $0 = yx + bx - by + a = (x-b)(y+b) + a + b^2$

$(x-b)(y+b) = -(a+b^2)$

Then all you need is to write RHS as multiplication of 2 integers: $-(a+b^2) = mn$ and then get 2 solutions $(m+b, n-b)$ and $(n+b, m-b)$ for all different $(m, n)$ pairs.

Corner case: $a = -b^2$, then all $(x,-b)$ is solution except $x=b$ since function is not defined at $x=b$