Number of triangles with integer sides Total number of right angle triangles whose inradius is $2013$ and sides are integer
Attempt: assuming that $a,b,c>0$ are the sides of a triangle.
so form a right angle triangle with sides $a,b,c$ and right angle at $C$
$\displaystyle r=(s-c)\tan \frac{C}{2}=(s-c)=\frac{a+b-c}{2}$ and $c^2=a^2+b^2$
$\displaystyle 2r = a+b-\sqrt{a^2+b^2}$ so $(\sqrt{a^2+b^2})^2 = (a+b-2r)$ 
$\displaystyle a^2+b^2 = (a+b)^2+4r^2-4r(a+b) = a^2+b^2+2ab-4r(a+b)$
$\displaystyle ab-2r(a+b)=0$
Could someone help me how to solve it, thanks.
 A: 
$\displaystyle a^2+b^2 = (a+b)^2+4r^2-4r(a+b) = a^2+b^2+2ab-4r(a+b)$

This should be
$$a^2+b^2=(a+b)^2+4r^2-4r(a+b)=a^2+b^2+2ab\color{red}{+4r^2}-4r(a+b)$$
from which we have
$$(a-2r)(b-2r)=2r^2=2^1\times 3^2\times 11^2\times 61^2\tag1$$
where $r=2013=3\times 11\times 61$.
We may suppose that $$-2r\lt a-2r\le b-2r\tag2$$
Note that a necessary and sufficient condition is $(1)$ and
$$(c=)\ a+b-2r\gt 0\iff (a-2r)+(b-2r)\gt -2r\tag3$$


*

*If both $a-2r$ and $b-2r$ are negative, then, from $(1)$ and $(2)$, there is only one case $(a-2r,b-2r)=(-3721,-2178)$. However, this is not sufficient since this does not satisfy $(3)$.

*If both $a-2r$ and $b-2r$ are positive, then, from $(1)$ and $(2)$, the number of cases is the half of the number of the positive divisors of $2^1\times 3^2\times 11^2\times 61^2$, and every case is sufficient since every case satisfies $(3)$.
Therefore, the answer is $$\frac{(1+1)\times (2+1)\times (2+1)\times (2+1)}{2}=\color{red}{27}$$
A: Remember the Pythagorian triple $(a,b,c)$ where
$$c=m^2+n^2, b=m^2-n^2,a=2mn. $$ We know that such triple defines a right triangle. The additional condition $$ab=2r(a+b)-2r^2 $$
implies that $$2mn(m^2-n^2)=2r(m^2-n^2+2mn)-2r^2 .$$
Now finding $m $ and $n$ answers your question.
