In a right triangle, the perimeter is equal to 30. How many integer values can the hypotenuse take? (Answer:2)
I did:
$a+b+h = 30\rightarrow a+b = h-30\\
a^2+b^2 = h^2 \rightarrow h = \sqrt{a^2+b^2}\\
a-b<h<a+b \rightarrow a-b < h < \sqrt{a^2+b^2}-30...\\
\text{I didn't find other relationships...}
 $

The sides of a right triangle with integer sides are of the form
$a(m^2-n^2), 2amn, a(m^2+n^2)$
for integer $a, m, n$
with $m > n$.
We therefore want
$p
=2a(m^2+mn)
=2am(m+n)$
where $p=30$ here,
or
$p/2
=am(m+n)$.
For p=30,
possible values for $a$ are
1, 3, 5, 15.
For these,
$m(m+n)
=15, 5, 3, 1
$.
If
$m(m+n)=15$
with $m > n$,
$m=3, n=2,$
sides $=5, 12, 13$.
If
$m(m+n)=5, 3, 1$,
no solutions.
Here are bounds on
$m$ and $n$
with $m > n$
and
$m(m+n)=r$
in terms of $r$.
If
$m(m+n)=r$,
$n
=\dfrac{r}{m}-m
$
so,
since $m > n$,
$\dfrac{r}{m}-m
\lt m$
or
$r < 2m^2$
or
$m > \sqrt{r/2}
$
and $m | r$.
Also,
if
$m(m+n)=r$,
$m^2+mn-r=0$,
$m
=\dfrac{-n+\sqrt{n^2+4r}}{2}
$.
Since $m > n$,
$-n+\sqrt{n^2+4r}
\gt 2n$
or
$n^2+4r > 4n^2
$
or
$n < \sqrt{4r/3}
$.
Similarly,
$r \ge m(m+1)$
or
$4r+1 \ge 4m(m+1)+1
=(2m+1)^2
$
so
$m \le \sqrt{4r+1}/2
=\sqrt{r+\frac14}
\lt \sqrt{r}+\frac12
$.
