Problem 316

Numbers in decimal expansions

Let `p` = `p _{1} p_{2} p_{3}` ... be an infinite sequence of random digits, selected from {0,1,2,3,4,5,6,7,8,9} with equal probability.

It can be seen that

It can also be seen that choosing a random real number from the interval [0,1) is equivalent to choosing an infinite sequence of random digits selected from {0,1,2,3,4,5,6,7,8,9} with equal probability.

For any positive integer `n` with `d` decimal digits, let `k` be the smallest index such that `p _{k, }`

Also, let

For example, if `n` = 535, then

for `p` = 31415926**535**897...., we get `k` = 9

for `p` = 35528714365004956000049084876408468**535**4..., we get `k` = 36

etc and we find that `g`(535) = 1008.

Given that , find

**
These problems are part of
Project Euler
and are licensed under
CC BY-NC-SA 2.0 UK
**