5. Find all functions $f: \mathbf{Z}_{+} \times \mathbf{Z}_{+} \rightarrow \mathbf{Z}_{+}$ satisfying:
(1) For all positive integers $a, b$, we have
$$
f(a, b)+a+b=f(a, 1)+f(1, b)+a b \text { ; }
$$
(2) If either $a+b$ or $a+b-1$ is divisible by a prime $p(p>2)$, then $p \mid f(a, b)$.
5. Substituting $(a, b)=(1,1),(a, b+1)$ into

Condition (1) yields
$$
\begin{array}{l}
f(1,1)=1, \\
f(a, b+1)+a+b+1 \\
=f(a, 1)+f(1, b+1)+a b+a .
\end{array}
$$

From Condition (1), we get
$$
\begin{array}{l}
f(a, b+1)-f(a, b) \\
\quad=f(1, b+1)-f(1, b)+a-1 .
\end{array}
$$

Let $p>2$ be a fixed prime number satisfying $p \mid(a+b)$. Then $p \mid f(a, b)$.
Since $p \mid(a+(b+1)-1)$, we have
$$
p \mid f(a, b+1) \text {. }
$$

For positive integers $a, b$, we have
$$
\begin{array}{l}
p \mid(f(1, b+1)-f(1, b)+a-1), \\
p \mid(f(1, b+1)-f(1, b)-b-1),
\end{array}
$$

and $p>2$ is a prime number satisfying $p \mid(a+b)$.
Notice that the right side of Conclusion (1) does not contain $a$.
Thus, fixing $b$ and varying $a$ will produce
$$
f(1, b+1)-f(1, b)-b-1
$$

with infinitely many odd prime factors, which only happens when the expression equals 0, i.e., for every positive integer $b$, we have
$$
\begin{array}{l}
f(1, b+1)=f(1, b)+b+1 . \\
\text { Then } f(1,2)=f(1,1)+2=1+2, \\
f(1,3)=f(1,2)+3=1+2+3 .
\end{array}
$$

Thus, by mathematical induction, we get
$$
f(1, n)=1+2+\cdots+n=\frac{n(n+1)}{2}\left(n \in \mathbf{Z}_{+}\right) \text {. }
$$

Similarly, substituting $(a, b)=(a+1, b)$ into (1), we get
$$
\begin{array}{l}
f(n, 1)=\frac{n(n+1)}{2}\left(n \in \mathbf{Z}_{+}\right) . \\
\text {By } f(a, b)+a+b \\
=f(a, 1)+f(1, b)+a b \\
=\frac{a(a+1)}{2}+\frac{b(b+1)}{2}+a b \\
\Rightarrow f(a, b)=\mathrm{C}_{a+b}^{2},
\end{array}
$$

which satisfies Condition (2).
Therefore, $f(a, b)=\mathrm{C}_{a+b}^{2}$ is the unique solution.