I have seen this problem a while ago and I wasn't able to find the answer.
$$ \begin{align*} P_n & = nd(7^n) \\ S & = \sum_{n=1}^{3981} P_n \end{align*} $$
Where $nd(n)$ is the number of digits of $n$, such that:
$$
\begin{align*}
nd&(5) & = 1 \\
nd&(10) & = 2 \\
nd&(5123) & = 4
\end{align*}
$$
How to find the value of $S$ without use of a computer/calculator?
I could expand $P_n$ as $$\lfloor n\log_{10}7\rfloor + 1$$ but then I have no idea what to do.