Given a number n, and a geometric progression a
i = b * q
i, i ≥ 0, what is the fraction of the elements of that progression with decimal notation that has the decimal notation of n as prefix ?
More formally, if c
i out of the first i elements of the progression start with n in decimal notation, you need to find the limit
. It is guaranteed that the limit always exists.
For example, n = 7, b = 1, q = 2. About 5.799% of all powers of two start with 7. (the smallest one is 2
46 = 70368744177664)