When is $n = \frac{a_{1}x^{2} + a_{2}x + a_{3}}{a_{4}x + a_{5}}$ an integer where $a_{i}$ are incredibly large integers?

47 Views Asked by At

I have the equation with the following form: $$n = \frac{a_{1}x^{2} + a_{2}x + a_{3}}{a_{4}x + a_{5}}$$ Where $a_{i}$ are incredibly large (e.g 1000 digits) but unrelated (not part of sequence or anything) known integers.

Problem: For an integer $x$, when is $n$ an integer?

Are there any known methods for solving this type of problem? My hope is that the solutions are not all just algorithms which stall with large integers.

EDIT* Since this is in reality a part of a larger problem, for this case, assume it always has a solution.

1

There are 1 best solutions below

4
On BEST ANSWER

By extended euclidean algorithm, you can reduce $\gcd(a_1x^2+a_2x+a_3,a_4x+a_5)$ into $\gcd(b_1x+b_2,b_3)$, from which it is easy (do some factoring and find modulo inverse if it exists).

For example, take $\frac{3x^2+7x-2}{x+7}$, then $$\begin{align*} \gcd(3x^2+7x-2,x+7)&=\gcd(3x^2+7x-2-3x(x+7),x+7)\\&=\gcd(-14x-2,x+7)\\&=\gcd(-14x-2+14(x+7),x+7)\\&=\gcd(96,x+7)\end{align*}$$

If we want $(x + 7) | (3x^2+7x-2)$, then $\gcd(x+7,3x^2+7x-2)=\gcd(x+7,96)=x+7$ i.e. $(x + 7) | 96$ i.e. $(x + 7)\in\{8, 12, 16, 24, 32, 48, 96\}$.