18. Find the number of right-angled triangles on the plane that satisfy the following conditions:
(1) The three vertices of the triangle are integer points, with the origin as the right-angle vertex;
(2) The coordinates of the incenter $M$ are $(96 p, 672 p)$, where $p$ is a prime number.
18. Let the right triangle $\triangle OAB$ shown in Figure 8 satisfy the given conditions, then the slope of the line $OM$ is $\tan \alpha = 7$;

the slope of the line $OA$ is $\tan \left(\alpha - 45^{\circ}\right) = \frac{\tan \alpha - 1}{1 + \tan \alpha} = \frac{3}{4}$;
the slope of the line $OB$ is $-\frac{4}{3}$.
Thus, we can set $A(4t, 3t), B(-3s, 4s) (s, t > 0)$. Then $t = 4t - 3t, s = -3s + 4s$ are both positive integers.
Let the inradius of $\triangle OAB$ be $r$, then
$$
r = \frac{\sqrt{2}}{2} \cdot OM = \frac{\sqrt{2}}{2} p \cdot 96 \sqrt{1^2 + 7^2} = 5p \times 96.
$$

Also, $OA = 5t, OB = 5s, AB = 5 \sqrt{t^2 + s^2}$. By $OA + OB - AB = 2r$, we get
$$
5 \sqrt{t^2 + s^2} = 5t + 5s - 2 \times 5p \times 96.
$$

Squaring both sides and simplifying, we obtain
$$
(t - 192p)(s - 192p) = 2p^2 \times 96^2 = 2^{11} \times 3^2 \times p^2.
$$

Since $5t > 2r, 5s > 2r$, it follows that $t - 192p > 0, s - 192p > 0$.
Therefore, the number of triangles that meet the conditions is equal to the number of positive divisors of $2^{11} \times 3^2 \times p^2$, which is

when $p \neq 2, 3$, there are $(11+1)(2+1)(2+1) = 108$ right triangles that meet the conditions;

when $p = 2$, there are $(13+1)(2+1) = 42$ right triangles that meet the conditions;

when $p = 3$, there are $(11+1)(4+1) = 60$ right triangles that meet the conditions.
(Ouyang Xinlong provided)