5. For any positive integer $n$, let $a_{n}$ denote the number of triangles with integer side lengths and the longest side length being $2 n$.
(1) Find the expression for $a_{n}$ in terms of $n$;
(2) Let the sequence $\left\{b_{n}\right\}$ satisfy
$$
\sum_{k=1}^{n}(-1)^{n-k} \mathrm{C}_{n}^{k} b_{k}=a_{n}\left(n \in \mathbf{Z}_{+}\right) \text {, }
$$

Find the number of positive integers $n$ such that $b_{n} \leqslant 2019 a_{n}$.
5. (1) Let the lengths of the three sides be integers, the longest side has a length of $2n$, and the shortest side has a length of $k(k \leqslant 2n)$, the number of such triangles is $a_{n}(k)$.
Thus, $a_{n}=\sum_{k=1}^{2n} a_{n}(k)$.
When $k \leqslant n$, the length of the third side can be
$$
2n+1-k, 2n+2-k, \cdots, 2n \text{, }
$$

there are $k$ possibilities;
When $nt .
\end{array}\right. \\
\text{By } \sum_{k=1}^{n}(-1)^{n-k} \mathrm{C}_{n}^{k} b_{k}=a_{n} \\
\Rightarrow \sum_{k=1}^{n} \mathrm{C}_{n}^{k} a_{k}=\sum_{k=1}^{n} \mathrm{C}_{n}^{k}\left(\sum_{t=1}^{k}(-1)^{k-t} \mathrm{C}_{k}^{t} b_{t}\right) \\
=\sum_{t=1}^{n}\left(\sum_{k=t}^{n}(-1)^{k-t} \mathrm{C}_{n}^{k} \mathrm{C}_{k}^{t}\right)=b_{n} \\
\Rightarrow b_{n}=\sum_{k=1}^{n} \mathrm{C}_{n}^{k} a_{k}=\sum_{k=1}^{n} \mathrm{C}_{n}^{k} k(k+1) \\
=n(n+1) \times 2^{n-2}+n \times 2^{n-1} \\
=n(n+3) \times 2^{n-2} \text{. } \\
\text{By } \frac{b_{n}}{a_{n}} \leqslant 2019 \\
\Rightarrow n(n+3) \times 2^{n-2} \leqslant 2019 n(n+1) \text{. } \\
\end{array}
$$

When $n \geqslant 2$, by
$$
\begin{array}{l}
\frac{n(n+3)}{n(n+1)} 2^{n-2}=\frac{n+3}{n+1} 2^{n-2} \\
\leqslant 2^{n-1} \leqslant 2019 \\
\Rightarrow n \leqslant 12 .
\end{array}
$$

Thus, the number of positive integers $n$ such that $\frac{b_{n}}{a_{n}} \leqslant 2019$ is 12.