How many non-congruent right triangles with positive integer leg lengths have areas that are numerically equal to $3$ times their perimeters? $\mathrm {(A)} 6\qquad$ $ \mathrm {(B)} 7\qquad$ $ \mathrm {(C)} 8\qquad$ $ \mathrm {(D)} 10\qquad$ $ \mathrm {(E)} 12$
Solution
Let $a, b$ be the legs and $c$ the hypotenuse. Then $\frac12 ab=3(a+b+c)$, so $c=\frac16ab-a-b$.
$c^2=(\frac16ab-a-b)^2=\frac1{36}a^2b^2-\frac13ab(a+b)+a^2+2ab+b^2$; since $c^2=a^2+b^2$, this gives $\frac1{36}a^2b^2-\frac13ab(a+b)+2ab=0$.
Dividing by $\frac{ab}{36}$: $ab-12(a+b)+72=0$, i.e. $(a-12)(b-12)=72$.
If both factors were negative, they would be at least $-11$, forcing $\{a-12,b-12\}=\{-8,-9\}$, i.e. $(a,b)=(4,3)$, which gives $c=2-7<0$. So both factors are positive, and with $a\le b$ the possible values $(a,b)=(13,84), (14,48), (15, 36), (16, 30), (18, 24), (20,21)$, totally 6 of them.