링크
An irrational decimal fraction is created by concatenating the positive integers:
0.123456789101112131415161718192021...
It can be seen that the 12th
digit of the
fractional part is 1.
If dn
represents the n
th
digit of the fractional part, find the value of the following
expression.
d1
d
10
d
100
d
1000
d
10000
d
100000
d
1000000
Solved by pencil
1~9 | 9 of 1-digits numbers, total 9 digits | 0 |
10 ~ 99 | 90 of 2-digits numbers, total 180 digits | 9 |
100 ~ 999 | 900 of 3-digits numbers, total 2700 digits | 189 |
1000 ~ 9999 | 9000 of 4-digits numbers, total 36000 digits | 2889 |
10000 ~ 99999 | 90000 of 5-digits numbers, total 450000 digits | 38889 |
100000 ~ 999999 | 900000 of 6-digits numbers, total 5400000 digits | 488889 |
d1 = 1
d10 = 1
d100 = 5
100 - 9 = 91th digit in 2-digits number block -> zero based index is 90
90 / 2 = 45th number in 2-digits number block = 55
90 % 2 = 0th digit in 55 = 5
d1000 = 3
1000 - 189 = 811th digit in 3-digits number block -> zero based index is 810
810 / 3 = 270th number in 3-digits number block = 370
810 % 3 = 0th digit in 370 = 3
and so on...