4. Let the lengths of the two legs of a right triangle be $a$ and $b$, and the length of the hypotenuse be $c$. If $a$, $b$, and $c$ are all integers, and $c=\frac{1}{3} a b-(a+b)$, find the number of right triangles that satisfy the condition.
(2010, National Junior High School Mathematics League, Tianjin Preliminary Contest)
By the Pythagorean theorem, we have $c^{2}=a^{2}+b^{2}$.
Substituting into the given equation and simplifying, we get
$$
\begin{array}{l}
a b-6(a+b)+18=0 \\
\Rightarrow(a-6)(b-6)=18 .
\end{array}
$$

Solving for $(a, b, c)$, we get
$$
=(7,24,25),(8,15,17),(9,12,15) .
$$