Digits in a book


A book has N pages, numbered the usual way, from 1 to N. The total number of digits in the page numbers is 2,808. How many pages does the book have?

Digits-in-a-bookCan you solve it?

Solution
            *
            *
            *     
The first 9 pages each contribute 1 digit, but then the pages 10 to 99 have 2 digits, and the pages 100 to 999 have 3 digits.

So we can write the following formula for a book containing N pages:
digits in book = N if N < 9
……………… = 2N – 9 if 10 < N < 99
……………… = 3N – 99 – 9 if 100 < N < 999

At 100 pages, the book has 192 digits, and at 999 pages, the book would have 2889, so we know the answer is somewhere from 100 to 999.

We solve the equation
3N – 108 = 2808 –> N = 972

This exercise also shows that for a book between 100 and 999 pages, the total number of digits in the book must be divisible by 3.


No comments:

Post a Comment