Solution (source code)

= Solution

\b[The claim needs a complete number of logarithmic decades.] For the normalized <log-uniform distribution> on the specified range, $U=\log_{10}X$ is uniform on $(a,b)$. Digit $i$ corresponds to $\{U\}\in[\log_{10}i,\log_{10}(i+1))$. If $b-a=m$ is a positive integer, the integral of a period-one indicator over $(a,a+m)$ is $m$ times its integral over one period. Thus <Benford law from logarithmic uniformity> gives
$$
\boxed{\mathbb P(D=i)=\log_{10}(1+1/i)
\quad\text{when }b-a\in\mathbb N.}
$$
This proves the intended case of integers $a<b$, and even permits noninteger $a$ when the span is an integer.

For arbitrary real $a<b$, the exact formula instead is
$$
\boxed{\mathbb P(D=i)=\frac1{b-a}\sum_{k\in\mathbb Z}
\left[\min\{b,k+\log_{10}(i+1)\}
-\max\{a,k+\log_{10}i\}\right]_+.}
$$
Only finitely many terms are nonzero. For a counterexample take $a=0$, $b=\log_{10}2$: then $1<X<2$, so the leading digit is always one. That is not <Benford law>. The unrestricted range in the PDF needs this qualification.