In numbering the pages of a book, a printer used 3289 digits. How many pages were in the book, assuming that the first page in the book was number 1.
Hello, MATNTRNG!
There's no formula for this problem.
I had to baby-talk my way through it.
In numbering the pages of a book, a printer used 3289 digits.
How many pages were in the book, assuming
that the first page in the book was number 1?
. . $\displaystyle \begin{array}{cc}\text{Pages} & \text{Digits} \\ \hline
1\text{ to } 9 & 9 \\
10\text{ to }99 & 180 \\
100\text{ to }999& 2700 \\ \hline
\text{Total:} & 2889
\end{array}$
Hence: .$\displaystyle 3289 - 2889 \:=\:400$ digits were used
. . in the first 100 four-digit numbers.
. . . . $\displaystyle \{1000,\:1001,\:1002,\:\hdots\:1099\}$
Therefore, the book had 1099 pages.
I think you basically found a formula.
$\displaystyle \{a_n\} = 9, 180, 2700,\dots$
$\displaystyle a_n=9\cdot10^{n-1}\cdot n$
$\displaystyle \displaystyle b_n=\sum_1^n a_n$
Being lazy to derive, I looked up on OEIS (id:A033713 - OEIS Search Results)
$\displaystyle b_n=\frac{1}{9}\cdot(n\cdot(10^{n+1})-(n+1)\cdot10^n+1)$
So if the number of digits used is d, then we find the n such that
$\displaystyle b_n \le d < b_{n+1}$
and the number of pages is
$\displaystyle p=10^n-1+\frac{b_{n+1}-d}{n+1}$
But in fact the $\displaystyle b_i$ are easily recognisable
Using not-exactly-standard notation, $\displaystyle b_n=[n-1](8\dots8)9$ where the number of 8's is n-1.
$\displaystyle \{b_n\}=9,189,2889,38889,488889,\dots$
In other words, $\displaystyle b_n = (n-1)\cdot10^n \ \ \ +\ \ \ (10^n-10)\cdot\frac{8}{9}\ \ \ +\ \ \ 9 $
So there's no need to solve for n, we can tell just by looking.