For certain ordered pairs $(a,b)$ of real numbers, the system of equations \[ ax+by=1 \] \[ x^2+y^2=65 \] has at least one solution, and each solution is an ordered pair $(x,y)$ of integers. How many such ordered pairs $(a,b)$ are there?
The integer points on $x^2+y^2=65$ are $(\pm1,\pm8)$, $(\pm8,\pm1)$, $(\pm4,\pm7)$, $(\pm7,\pm4)$, giving $16$ points.
The line $ax+by=1$ does not pass through the origin and meets the circle only at integer points: either it passes through two of them (not opposite points, since then it would pass through the origin): $\binom{16}2-8=112$ lines; or it is tangent at one: $16$ lines.