There is no formula for this problem.
We must "talk" our way through it.
The pages of a book are numbered, beginning with page 1.
There is a total of 2,989 individual digits needed to print the all page numbers.
How many pages does the book contain?
There are 9 one-digit numbers (1 to 9): . digits.
There are 90 two-digit numbers (10 to 99): . digits.
There are 900 three-digit numbers (100 to 999): . digits.
We have accounted for: digits.
There are: . digits left.
They will be used by the first 25 four-digit numbers (from 1000 to 1024).
Therefore, the book contains pages.