9. Let the positive integer $n$ satisfy $31 \mid\left(5^{n}+n\right)$. Then the minimum value of $n$ is $\qquad$ .
9. 30 .

Given $5^{3} \equiv 1(\bmod 31)$, when $n=3 k\left(k \in \mathbf{Z}_{+}\right)$, $5^{n}+n \equiv 1+n \equiv 0(\bmod 31)$, at this time, the minimum value of $n$ is $n_{\text {min }}=30$;
When $n=3 k+1\left(k \in \mathbf{Z}_{+}\right)$,
$$
5^{n}+n \equiv 5+n \equiv 0(\bmod 31),
$$

at this time, the minimum value of $n$ is $n_{\text {min }}=88$;
When $n=3 k+2\left(k \in \mathbf{Z}_{+}\right)$,
$$
5^{n}+n \equiv 25+n \equiv 0(\bmod 31),
$$

at this time, the minimum value of $n$ is $n_{\text {min }}=68$.
Therefore, the minimum value of $n$ that satisfies the condition is $n_{\min }=30$.