Number of Distinct Lines Passing Through Two Lattice Points

120 Views Asked by At

Consider the point $P(0,2017)$ in the coordinate plane. I want to find the number of distinct lines passing through $P$ that also intersect $y=x^2$ in exactly two lattice points.

Suppose there is a line $L$ that intersects $y=x^2$ in two lattice points $A(a,a^2)$ and $B(b,b^2)$, and passes through $P$. Then, the slope of the line will be $\frac{a^2-2017}{a}$. But it will also be $\frac{b^2-2017}{b}$. Further, the slope will also be $\frac{a^2-b^2}{a-b}$. We can write this as $a+b$ as the $a=b$ case doesn't give us two distinct points. So, $a+b=\frac{a^2-2017}{a}=\frac{b^2-2017}{b}$. From this, we get $a+b=a-\frac{2017}{a}$. This means that $b=-\frac{2017}{a}$. But, we want $b$ to be an integer. Clearly, this happens only when $a=1,-1,2017,-2017$ owing to the primality of $2017$. So we get that $(a,b)=(1,-2017),(-1,2017),(2017,-1),(-2017,1)$. This means that there are exactly two such lines $L$ that satisfy the given conditions.

My questions are- Is my solution correct? If not, where did I go wrong? Is there any faster way to approach this?