Find the sum of all integral $y$ such that the equation

$y=\dfrac{x^2+2014x-1007}{x^2-2014x+1007}$

has an integral solution $x$ .

The answer is 8054.

**
This section requires Javascript.
**

You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.

Firstly, observe that the equation can be restated into: $y = \frac{x^2 + 19(53)(2x-1)}{x^2 - 19(53)(2x-1)}$ , for integers $x,y$ . Let $a = 2x-1$ . $y = \frac{x^2 + 19(53)a}{x^2 - 19(53)a} = 1 + \frac{2 \cdot 19(53)a}{x^2 - 19(53)a}$ Notice for $y \in \mathbb{Z}$ , $(x^2 - 19(53)a) | (2 \cdot 19(53)a)$ . From here, there are 2 cases to consider:

Case 1: When the denominator is equal to 1 or -1Thus, $x^2 - 19(53)a = \pm 1$ . But substituting $a = 2x-1$ in, we get $x^2 - 2 \cdot 1007x + 1007 = \pm 1$ . Using the quadratic formula, we see that these 2 equations have no integer solution for $x$ . Thus, no solution for Case 1.Case 2: When denominator $\neq 1, -1$That implies that $19 | x^2$ and $53 | x^2$ . Since $19$ and $53$ are both primes, $19 | x, 53 | x$ .

Firstly, $x$ can be $0$ since any number divides $0$ . Then, $y = -1$ .

Suppose $x\neq 0$ , $19 \cdot 53 = 1007 | x$ . Let $x=1007k$ , for some integer $k$ . Then we see that the expression (of the fraction - we ignore the 1 first) becomes: $\frac{2 \cdot 1007(2 \cdot 1007k - 1)}{(1007k)^2 - 1007(2\cdot 1007k - 1)}$ $= \frac{1007(4 \cdot 1007k - 2))}{1007(1007k^2 - 2\cdot 1007k + 1)}$ $= \frac{4 \cdot 1007k - 2}{1007k^2 - 2\cdot 1007k + 1}$ . Once again, we want the above to be an integer, hence denominator divides numerator evenly. This implies that: $1007k^2 - 2\cdot 1007 + 1 \leq 4 \cdot 1007k - 2$ $1007k^2 - 6\cdot 1007k + 3 \leq 0$ . Using the quadratic formula, we see that the roots, $k$ , of the equations are approximately (larger than) $0$ and (smaller than) $6$ . We also know that the function is an increasing one (meaning that the shape of this quadratic is a U shape - you can use differentiation or test out some small values to verify).

Hence, to find the other solutions for Case 2, you just have to try $k =1,2,3,4,5$ . You will realise that $k=2$ yields, $x=2\cdot 1007 = 2014$ and $y = \frac{4 \cdot 1007(2) - 2}{1007(2)^2 - 2\cdot 1007(2) + 1} + 1=8055$ . Hence sum of all integral $y$ is $-1 + 8055 = \boxed{8054}$ .