How can I find the integer solutions of the following problem
$\frac{2+16x-x^2}{2(3+x)}$
e.g. if $x=2$ then we have $\frac{30}{10}=3$
Context
I have a data with infinity columns and rows. I need to start at a cell and pick a path to go to another cell
e.g. If I pick 57 as start point and want to go to 55 as my goal, I need to move two cell right ($x=+2$) and three cell up (= $-3$ cell down) ($y=-3$)
| $i$ | $x_1=1$ | $x_2=2$ | $x_3=3$ | $x_4=4$ | $x_5=5$ | $x_6=6$ |
|---|---|---|---|---|---|---|
| 8 | 15 | 28 | 39 | 48 | 55 | 60 |
| 9 | 17 | 32 | 45 | 56 | 65 | 72 |
| 10 | 19 | 36 | 51 | 64 | 75 | 84 |
| 11 | 21 | 40 | 57 | 72 | 85 | 96 |
| 12 | 23 | 44 | 63 | 80 | 95 | 108 |
| 13 | 25 | 48 | 69 | 88 | 105 | 120 |
| 14 | 27 | 52 | 75 | 96 | 115 | 132 |
| 15 | 29 | 56 | 81 | 104 | 125 | 144 |
| 16 | 31 | 60 | 87 | 112 | 135 | 156 |
| 17 | 33 | 64 | 93 | 120 | 145 | 168 |
| 18 | 35 | 68 | 99 | 128 | 155 | 180 |
Formula
For x move to right we have :
$value_{(n+x,i)}=value_{(n,i)}+(({o_{(n-1)}}_i)^2-({o_{(n-1-x)}}_i)^2)$
For y move to down we have :
$value_{(n,i+y)}=value_{(n,i)}+2*y_n*y$ ($y_n$ changes when we move horizontally and depended on $x$, see general form)
and
${o_(n)}_i = 2*i-2(x_n-1)-1$
and
$x_n=n$
In general form, For x move to right and y move to down we have
$value_{(n+x,i+y)}=value_{(n,i)}+(({o_{(n-1)}}_i)^2-({o_{(n-1-x)}}_i)^2)+value_{(n,i)}+2*(x_n+x)*y$
Example
In cell 57 we have x_3=3 and i=11, I am looking for a $x$ and $y$ to move to cell 55. The correct answer is $x=2$ and $y=-3$
I think the best solution for my problem is changing it to another problem (if you have better solution let me know)
For some boring reasons, I know that $57+(({o_{(2)}}_{11})^2-({o_{(2-x)}}_{11})^2)-55$ is dividable by $2*(x_3+x)$
which convert problem to finding integer solution for $\frac{2+16x-x^2}{2(3+x)}$
If $2(x+3)$ divides $-x^2+16x+2$, then $x+3$ divides $-x^2+16x+2$. By polynomial long division $$-x^2+16x+2=(x+3)(-x+19)-55.$$ Hence $x+3$ divides $55$, i.e. $x+3\in \{\pm 1, \pm 5, \pm 11, \pm 55\}$. Thus $$x \in \{-58, -14, -8, -4, -2, 2, 8, 52\}.$$ We can check that indeed all of these $x$ values give an integer for the original expression.