# Bounds on difference of squares representations of integers [duplicate]

Possible Duplicate:
$a^2-b^2 = x$ where $a,b,x$ are natural numbers

I'm trying to find all the $(m,n)$ pairs that satisfy $m^2-n^2=r$, where $r$ is a given positive odd integer, $m>n>0$, $\gcd (m,n) =1$, and $m$ and $n$ are of opposite parity.

For example: Given $m^2-n^2=21$, I'm supposed to figure out that the only solutions are (5,2) and (11,10).

My course materials state that that the method is to systematically try $n=1,2,3,...,10$ (i.e. $1\leq n<\frac r2=\frac{21}2$). But why can't $n$ exceed $\frac r2$?

On a related note, for $m^2+n^2=r$ satisfying the same conditions as above, I can see that $1\leq n<\sqrt \frac r2$. (Please correct me if I'm wrong about this.)

Thank you.

-

## marked as duplicate by ShreevatsaR, Phira, Thomas, Henry T. Horton, ArkamisNov 1 '12 at 16:08

If $(m+n)(m-n)=d$ and we take $m>n>0$, we can see that the largest difference between the two factors occurs when $m+n=d$, and $m-n=1$.

Taking the difference we get $2n=d-1$ so that the greatest possible value of $n$ is $\frac {d-1}2$.

-
Thank you, Mark. –  Ryan Nov 1 '12 at 15:06
The differences between squares increase as the squares themselves increase. If $n,\ m > 10$ then the smallest difference possible is $$12^2 - 11^2 = (12 - 11)(12 + 11) = 23$$ which is already larger than your answer.