Smallest positive integer such at $2^n$ contains 2018 as a substring?(Give approximation)

expected valueintegers

This is what the solution says:

Since each string of 4 digits are independent, having 2018 in a string has probability of $(1/10)^4$

By geometric distribution, expected value of digits to obtain 2018 in a string would be $10^4$

So we need to see how many powers do we need to write before we reach $10^4$ units.

Since $2^{10} \approx 1000 $, we can say $2^n$ has $0.4$ digits.

So the number of digits is:

$\sum_{r=1}^{n}0.3r = 0.2n^2$

Thus $0.2n^2 = 10^4$ where $n \approx 231$

For the last part I don't get why the solution put summation of $0.3r$. According to the explanation above, isn't it correct just to solve the equation

$0.4n = 10^4$ because we need to see whether $2^n$ has $10^4$ digits?

summation implies the summation of the digits, but that means writing all numbers $2^n$ side by side, which the problem did not intended.

Hope anyone would shed some light with this one.

Best Answer

The digits of 2^n are pseudo-random (hard to predict, behaving like random except they are of course deterministic) except for the first and last few digits. So if you calculate values 2^n until you produced 10,000 digits, there is a good chance that four consecutive digits equal 2018, or any other four digit sequence. Of course it may happen a bit earlier or later.

2^n has roughly 0.3n digits. The powers 2^k for k <= n have a total of 0.15n^2 digits. You can reasonably expect a solution for some k <= sqrt(10,000 / 0.15) or k <= 260, which would have about 78 digits.

A much smaller solution (say k <= 100) or having to calculate many more powers (say first k >= 1000) is possible, but unlikely.

And as said elsewhere, there is an infinite number of k such that 2^k even starts with 2018.

Related Question