Problem 701: (1999 AIME, 3)
Find the sum of all positive integers $n$ for which $n^2-19n+99$ is a perfect square.
- Let $n^2-19n+99=k^2$ with $k\ge0$. Multiplying by $4$ gives $(2n-19)^2+35=(2k)^2$, so $(2k-2n+19)(2k+2n-19)=35$.
- The factor pairs $(1,35)$ and $(5,7)$, in either order, give $2n-19=\pm17$ or $\pm1$, i.e.\ $n=18,1,10,9$.
- The sum is $38$. The answer is $\boxed{038}$.
Find the sum of all positive integers $n$ for which $n^2-23n+141$ is a perfect square.