10. Given the sequence $\left\{a_{n}\right\}$ satisfies $a_{1}=p, a_{2}=p+1, a_{n+2}-2 a_{n+1}+a_{n}=n-20$, where $p$ is a given real number, $n$ is a positive integer, try to find the value of $n$ that minimizes $a_{n}$.
10. Solution: Let $b_{n}=a_{n+1}-a_{n}, n=1,2, \cdots$, by the given condition $a_{n+2}-2 a_{n+1}+a_{n}=n-20$, we have $b_{n+1}-b_{n}=n-20$, and $b_{1}=1$,
thus $\sum_{i=1}^{n-1}\left(b_{i+1}-b_{i}\right)=\sum_{i=1}^{n-1}(i-20)$, that is, $b_{n}-b_{1}=[1+2+\cdots+(n-1)]-20(n-1)$. $\therefore b_{n}=\frac{(n-1)(n-40)}{2}+1$. (*)
Also, $a_{1}=p, a_{2}=p+1$, then $a_{3}=2 a_{2}-a_{1}+1-20=p-17<a_{1}<a_{2}$.
$\therefore$ When the value of $a_{n}$ is the smallest, there should be $n \geqslant 3, a_{n} \leqslant a_{n+1}$, and $a_{n} \leqslant a_{n-1}$.
That is, $b_{n}=a_{n+1}-a_{n} \geqslant 0, b_{n-1}=a_{n}-a_{n-1} \leqslant 0$. From (*) we get $\left\{\begin{array}{l}(n-1)(n-40) \geqslant-2 \\ (n-2)(n-41) \leqslant-2\end{array}\right.$, since $n \geqslant 3$, and $n \in$ $\mathbf{N}^{*}$, solving gives $\left\{\begin{array}{l}n \geqslant 40 \\ n \leqslant 40\end{array}, \therefore\right.$ when $n=40$, $a_{40}$ has the smallest value.