jueves, 3 de mayo de 2007

Páginas y dígitos

To number a book from 1 up to its last page took 552 digits.
How many pages are there in the book?
If P(n) is the number of digits used to number n pages, the formula for P(n) is:

P(n) = n , if n is between 1 and 9
P(n) = 2n-9 , if n is between 10 and 99
P(n) = 3n-108 , if n is between 100 and 999
P(n) = 4n-1107 , if n is between 1000 and 9999
P(n) = kn-[ (10k -1)/9 - k ] , if n is a k-digit number.
For the question at hand, we simply have to solve the equation 552=(3n-108) and that means that there are n=220 pages in the book.

León-Sotelo