# Perfect squares of n and n+99

• Jul 7th 2010, 09:47 AM
Mukilab
Perfect squares of n and n+99
How many positive integer solutions are there n such that both n and n+99 are perfect squares?

I believe there is only 1 solution.

Any tips on how to tackle this? I haven't really come up with a method or a formula to calculate it, simply gone through the first 20 squares, and I doubt there will be anything after that :o

• Jul 7th 2010, 09:56 AM
rabih2011
i tried the first couple on paper only the number 1 is working. so i guess that it
• Jul 7th 2010, 10:11 AM
earboth
Quote:

Originally Posted by Mukilab
How many positive integer solutions are there n such that both n and n+99 are perfect squares?

I believe there is only 1 solution.

Any tips on how to tackle this? I haven't really come up with a method or a formula to calculate it, simply gone through the first 20 squares, and I doubt there will be anything after that :o

I can't provide you with an equation or algorithm but I used an Excel table and have found:$\displaystyle \begin{array}{cccc}nr&sqr&NR&SQR\\1& 1& 10& 100\\ 15& 225& 18& 324\\ 49& 2401& 50& 2500\end{array}$

Now the difference between the squared numbers is 1. So there can't be any other pair of numbers which satisfy the given conditions.
• Jul 7th 2010, 10:22 AM
Mukilab
How does 49 satisfy the conditions?

You must have misread my question

take n as 1
1^2 is a perfect square

(1+99)^2 = 100 = 10^2

49 does not suit this

49+99=148

15 does not suit this
• Jul 7th 2010, 10:25 AM
undefined
Quote:

Originally Posted by earboth
I can't provide you with an equation or algorithm but I used an Excel table and have found:$\displaystyle \begin{array}{cccc}nr&sqr&NR&SQR\\1& 1& 10& 100\\ 15& 225& 18& 324\\ 49& 2401& 50& 2500\end{array}$

Now the difference between the squared numbers is 1. So there can't be any other pair of numbers which satisfy the given conditions.

$\displaystyle n \in \{1, 225, 2401\}$ is correct. The answer can be obtained with a Diophantine equation.

$\displaystyle n = k^2$

$\displaystyle n+99 = m^2$

$\displaystyle k^2-m^2+99 = 0$

See Dario Alpern's quadratic Diophantine solver and plug in $\displaystyle a=1, c=-1, f=99$ and select "step-by-step".

Edit: Actually, the steps shown for this particular problem aren't as illuminating as they often are. Not sure the best way to work it out on paper.

Edit 2: See Soroban's post.. seems so obvious now.
• Jul 7th 2010, 10:28 AM
earboth
Quote:

Originally Posted by Mukilab
How does 49 satisfy the conditions?

You must have misread my question

take n as 1
1^2 is a perfect square

(1+99)^2 = 100 = 10^2

49 does not suit this

49+99=148

15 does not suit this

So take

$\displaystyle 225 +99 = 324 = 18^2$

$\displaystyle 2401+99 = 2500 = 50^2$
• Jul 7th 2010, 10:36 AM
Mukilab
that's taking it as n^2+99 but the actual question is n+99
• Jul 7th 2010, 10:39 AM
undefined
By the way, I worked it out by brute force initially as well using PARI/GP which is a great tool (and hopefully you won't get spoiled by it). I wrote

Code:

f(n)=if(sqrt(n)==floor(sqrt(n)),1,0) for(i=0,10000,if(f(i)&&f(i+99),print(i)))
Could also have used

Code:

f(n)=if(floor(sqrt(n))^2==n,1,0)
which ought to be a bit more efficient.
• Jul 7th 2010, 10:42 AM
undefined
Quote:

Originally Posted by Mukilab
that's taking it as n^2+99 but the actual question is n+99

There are three solutions.

$\displaystyle n=1=1^2$ where $\displaystyle n+99=100=10^2$

$\displaystyle n=225=15^2$ where $\displaystyle n+99=324=18^2$

$\displaystyle n=2401=49^2$ where $\displaystyle n+99=2500=50^2$
• Jul 7th 2010, 10:55 AM
Soroban
Hello, Mukilab!

Quote:

How many positive integers $\displaystyle n$ are there
such that both $\displaystyle n \text{ and }n+99$ are perfect squares?

We have two squares that differ by 99: .$\displaystyle a^2 - b^2 \:=\:99$

So we have: .$\displaystyle (a+b)(a-b) \:=\:\begin{Bmatrix}99\cdot1 \\ 33\cdot 3 \\ 11\cdot 9 \end{Bmatrix}$

Solve the three systems of equations:

. . $\displaystyle \begin{array}{ccc}a+b &=& 99 \\ a-b &=& 1 \end{array} \quad\Rightarrow\quad (a,b) \:=\:(50,49) \quad\Rightarrow\quad n = 2401$

. . $\displaystyle \begin{array}{ccc}a+b &=& 33 \\ a-b &=& 3\end{array} \quad\Rightarrow\quad (a,b) = (18,15) \quad\Rightarrow\quad n = 225$

. . $\displaystyle \begin{array}{ccc}a+b &=& 11 \\ a-b &=& 9 \end{array} \quad\Rightarrow\quad (a,b) = (10,1) \quad\Rightarrow\quad n = 1$