$29 . n$ is the smallest positive integer such that $5^{n}+n$ is divisible by 31. Then the value of $n$ is ( ).
(A) 23
(B) 30
(C) 51
(D) 68
(E) 88
29. B.

Let $n=3 q+r, r \in\{0,1,2\}$. Since
$$
5^{3}-1=(5-1)\left(5^{2}+5+1\right)=4 \times 31 \text {, }
$$

there exists an integer $k$ such that
$$
\begin{array}{l}
5^{n}-5^{r}=5^{3 q+r}-5^{r}=5^{r}\left(5^{3 q}-1\right) \\
=5^{r}\left(5^{3}-1\right)\left(5^{3 q-3}+5^{3 q-6}+\cdots+5^{3}+1\right)=31 k .
\end{array}
$$
The necessary and sufficient condition for $5^{n}+n$ to be divisible by 31 is that $5^{r}+n(=$ $\left.\left(5^{n}+n\right)-\left(5^{n}-5^{r}\right)\right)$ is divisible by 31.

When $r=0$, $n=3 q$, it is required that $5^{r}+n=1+n$ is divisible by 31; it is easy to see that $n=30$ is the smallest $n$ that satisfies the condition;

When $r=1$, it is required that $5^{r}+n=5+n$ is divisible by 31, the smallest $n$ that satisfies the condition is 88;

When $r=2$, it is required that $5^{r}+n=25+n$ is divisible by 31, the smallest $n$ that satisfies the condition is 68.
Therefore, $n=30$.