Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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


share|cite|improve this question
up vote 1 down vote accepted

Perhaps I'm missing something, but I think there's a basic mistake from the beginning:

$$n^2-19n+99=k^2\Longleftrightarrow4n^2-76n+396=4k^2\Longleftrightarrow (2n-19)^2\color{red}{+}35=(2k)^2\Longleftrightarrow$$

$$\Longleftrightarrow (2(n-k)-19)(2(n+k)-19)=-35$$

From here it follows at once that you need to express $\,-35\,$ as a product of odd integers with different sign , say for example:

$$2(n-k)-19=\pm 35\Longleftrightarrow n-k=\begin{cases}\;27\\{}\\\!-8\end{cases}\\{}\\2(n+k)-19=\mp 1 \Longleftrightarrow n+k=\begin{cases}\;\;9\\{}\\10{}\end{cases}$$

and thus adding

$$2n=\begin{cases}18\\\;\;2\end{cases}\;\;\Longrightarrow \;\;\text{two solutions,}\;\;n=9\,,\,1$$

Do the above again with $\,\pm 5\;\;,\;\;\mp 7\,$ for other possible solutions (hint: at least one solution more)

share|cite|improve this answer

$(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$


$\Rightarrow 2k+y=35$

$\Rightarrow 2k-y=1$

$\Rightarrow k=9,y=17$


$\Rightarrow 2k+y=-35$

$\Rightarrow 2k-y=-1$

$\Rightarrow k=-9,y=-17$


$\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$

share|cite|improve this answer
Thanks Abhra Abir Kundu for giving me a precious solution. But I want to check using ordered pairs like $((2n-19),2k) = (\pm 6, \pm 1)$ my qusetion is how can i calculate other ordered pairs like this – juantheron Mar 2 '13 at 8:54
You are welcome. @juantheron You can calculate the values of n using the formula I have just posted which will give u yours ordered pairs. – Abhra Abir Kundu Mar 2 '13 at 8:57
The first equation is wrong ( I know, the OP wrote it): it must $\,-35\,$ instead... – DonAntonio Mar 2 '13 at 14:01

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.