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...}
 $

There are indeed not enough restrictions. We can write $\cos(\theta) = \frac a h$, $\sin(\theta) = \frac b h$, hence $h\cos(\theta)+h\sin(\theta)+h=30$, or $\cos(\theta)+\sin(\theta)+1 = \frac{30}h$.
$\cos(\theta)+\sin(\theta)$ is equal to $\sqrt 2\sin(\theta +\frac{\pi}4)$, so we get $\sqrt 2 \sin(\theta +\frac{\pi}4) = \frac2 {\sqrt 2}(\frac{30}h-1)$ or $\theta = \sin^{-1}(\frac2 {\sqrt 2}(\frac{30}h-1))-\frac{pi}4$, which has solutions for more than two values of $h$.
If we have the requirement that all sides are positive integers, there's only one solution.
All Pythogorean triples are of the form $2kmn$, $k(m^2-n^2)$, $k(m^2+n^2)$ for some positive integers $k,n,m$. $k$ has to be a factor of $30$, so that gives $1,2,3,5,6,10,30$. The smallest Pythogorean triplet is $3,4,5$, which adds up to $12$, for $k=2.5$, which doesn't work because $k$ needs to be an integer. All larger $k$ are prohibited (a larger $k$ would means that the reduced triples is smaller, but $3,4,5$ is smallest). The only smaller $k$ is $1$, so we now know that any solution must be of the form $2mn$, $m^2-n^2$, $m^2+n^2$. Adding those together, we get $2m^2+2mn=2m(m+n)$, thus $m(m+n)=15$. The only factorizations of $15$ are $15\cdot1$ and $5\cdot3$. The factorization $15\cdot1$ would require $m=1$, which doesn't work ($m>n$, so if $m=1$, $n=0$, but $m$ and $n$ both have to be positive), so that leaves $5\cdot3$. Since $m+n>m$, the $3$ must be $m$ and the $5$ is $m+n$, so $n=2$. That gives $5,12,13$.
