## Numbers in decimal expansions

### Problem 316

Published on Saturday, 25th December 2010, 01:00 pm; Solved by 405; Difficulty rating: 55%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

`p`corresponds to the real number 0.

`p`....

_{1}p_{2}p_{3}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, }`

`p`, ...

_{k+1}`p`are the decimal digits of

_{k+d-1}`n`, in the same order.

Also, let

`g`(

`n`) be the expected value of

`k`; it can be proven that

`g`(

`n`) is always finite and, interestingly, always an integer number.

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

__: represents the floor function.__

*Note*