In a random sequence of a million decimal digits what is the probability that there are exactly 100000 of each digit?

104 Views Asked by At

I want to check if the solution of this problem, which was extracted from Donald Knuth Book volume 2, is correct.

Lets put only one's. We have one million positions where to put 100000 '1's digits. This give us:

$\binom{1000000}{100000}$ Combinations.

Now to put the two's, we have 900000 positions and 100000 '2's, so:

$\binom{900000}{100000}$ Combinations.

And so on.

We have finally:

$\binom{1000000}{100000} * \binom{900000}{100000} * ... * \binom{100000}{100000} = \dfrac{1000000!}{100000!*900000!} * \dfrac{900000!}{100000!*800000!} ... \dfrac{100000!}{100000!*0!}$

Simplifying:

Total combinations of exactly 100000 of each digits= $\dfrac{1000000!}{100000!^{10}}$

The total combinations overall is $10^{10^6}$.

Thus:

Probability = $\dfrac{\dfrac{1000000!}{100000!^{10}}}{10^{10^6}}$

Thanks.

1

There are 1 best solutions below

1
On

The original question has already been answered, and the answer is correct, but it's very difficult to see how large it is, as DreiCleaner has observed in a comment.

Let's generalize the problem: in a sequence of $kn$ base-$k$ digits, what's the probability that there are $n$ of each digit? (The original problem has $k = 10$ and $n = 10^5$.)

The original analysis still holds and the answer is $$f(n, k) = {(nk)! \over (n!)^k k^{kn}}$$.

To see how large this is we can use Stirling's approximation. We have

$$x! \approx {\sqrt{2\pi x} (x/e)^x}$$

and applying this to $f(n, k)$ gives

$$f(n, k) \approx {\sqrt{2\pi nk} (nk/e)^{nk} \over \left(\sqrt{2\pi n} (n/e)^n \right)^k k^{kn}}.$$

A lot of terms in that product cancel, and it actually turns out that

$$f(n, k) \approx {\sqrt{2\pi nk} \over (2\pi n)^{k/2}} = {\sqrt{k} \over (2\pi n)^{(k-1)/2}} $$

For the original question with $k = 10, n = 10^5$ this is

$$f(n, k) \approx {\sqrt{10} \over (2\pi \times 10^5)^{9/2}}$$

which is surprisingly not that small - it's large values of $k$ (the base) that really make this small. It's about $2.6 \times 10^{-26}.$