<s>[INST] positive integer value of $n$ for which $n^2-19n+99$ is a perfect square. Calculate positive integer value of $n$ for which $n^2-19n+99$ is a perfect square.
My Try:: Let $n^2-19n+99 = k^2$ where $k\in \mathbb{Z}$
$4n^2-76n+396 = 4k^2 $ or $(2n-19)^2-35 = (2k)^2$
$(2n-19)^2-(2k)^2 = 35$
now we have to take two perfect square whose difference is $ = 35$
so one pair is $(6^2,1^2)$
now my question is how can i calculate for other ordered pairs
Thanks
 [/INST] $(2n-19)^2-(2k)^2 = -35$
$\Rightarrow (2n-19-2k)(2n-19+2k)=35$
$35=5\times 7=35\times 1=-5\times -7=-35\times -1$
Check the possible pairs.
Another way: $n^2-19n+99 = k^2$ is a quadratic in n so for it to have integral(perhaps rational) roots its determinant is a square.
$\Rightarrow 19^2-4(99-k^2)=y^2,y\in \mathbb{N}$
$\Rightarrow19^2-4.99=y^2-4k^2\Rightarrow 361-396 \Rightarrow35=(2k)^2-y^2=(2k+y)(2k-y)$
$35=5\times 7=35\times 1=-5\times-7=-35\times -1$
$\Rightarrow 2k+y=5$
$\Rightarrow 2k-y=7$
$\Rightarrow 4k=12\Rightarrow k=3,y=-1$ 
or,
$\Rightarrow 2k+y=35$
$\Rightarrow 2k-y=1$
$\Rightarrow k=9,y=17$
or 
$\Rightarrow 2k+y=-35$
$\Rightarrow 2k-y=-1$
$\Rightarrow k=-9,y=-17$
or
$\Rightarrow 2k+y=-5$
$\Rightarrow 2k-y=-7$
$\Rightarrow k=-3,y=1$
So we have all the solutions.
Check for other cases also when the values gets reversed.
We have $n=(19+y)/2$
</s>