Four, it is known that the obtuse triangle $\triangle A B C$ satisfies the following conditions:
(1) The lengths of $A B, B C, C A$ are all positive integers;
(2) The lengths of $A B, B C, C A$ are all no more than 50;
(3) The lengths of $A B, B C, C A$ form an arithmetic sequence with a positive common difference.

Find the number of obtuse triangles that satisfy conditions (1), (2), and (3), and determine the side lengths of the triangle with the largest perimeter among them.
Let \( AB = a - d, BC = a, CA = a + d \), then
according to the problem, we have \(\left\{\begin{array}{l}0a + b, \\ (a + d)^{2} > a^{2} + (a - d)^{2} .\end{array}\right.\)
Simplifying, we get \(\left\{\begin{array}{l}00) .
\[
(1) If \(4d - 1 \leq 50 - d\). That is, \(1 \leq d \leq 10\), then condition \((*)\) is
\[
2d + 1 \leq a \leq 4d - 1 (d > 0),
\]

For a fixed \(d\), \(a\) has \(2d - 1\) possible values.
(2) If \(4d - 1 > 50 - d\), that is, \(d \geq 11\), then condition \((*)\) is
\[
2d + 1 \leq a \leq 50 - d
\]

For a fixed \(d\), \(a\) has \(50 - 3d\) possible values.
Therefore, the total number of triangles is
\[
\begin{aligned}
& \sum_{d=1}^{10}(2d - 1) + \sum_{d=11}^{50-3d>0}(50 - 3d) = 100 + \sum_{d=11}^{16}(50 - 3d) \\
= & 100 + 50 \times 6 - 3 \times \frac{6(11 + 16)}{2} = 157 \text{ triangles.}
\end{aligned}
\]
When \(d = 10\), the perimeter of the triangle \(3a\) reaches its maximum value \(3 \times 39 = 117\).
At this time, the lengths of the three sides of the triangle are \(29, 39, 49\) or \(28, 39, 50\).