An infinite sequence of decimal digits is obtained by writing the positive integers in order: 123456789101112131415161718192021 ... . Define f(n) = m if the 10n th digit forms part of an m-digit number. For example, f(1) = 2, because the 10th digit is part of 10, and f(2) = 2, because the 100th digit is part of 55. Find f(1987).
Solution
Answer: 1984.
Easy.
The first 9 numbers have 1 digit, the next 90 2 digits, the next 900 3 digits and so on. So the m-digit numbers and below constitute the first 9(1 + 2.10 + ... + m.10m-1) = 9(1 - (m+1) 10m + m 10m+1)/(1 - 10)2 = 1/9 (1 - (m+1) 10m + m 10m+1) digits. For m = 1983 this is about 0.2 101987 and for m = 1984 about 2 101987. So the 101987th digit is in a 1984-digit number.
© John Scholes
jscholes@kalva.demon.co.uk
7 Oct 1999