Let p(n) be the probability that a random n-digit integer has all 10 digits occurring each at least once.

Let us allow leading zeroes; e.g. 0000018274 will be included in the set of 10-digit numbers).

So p(9) is 0 , p(10) = 10!/10^{10} and p(1000) would be very close to 1.

a. What is the smallest n for which p(n) > 1/2?

b. >3/4?

c. >.95?

I am going to redefine P(n) as a vector representing the frequencies of the number of different digits. The elements in order are the fraction of n digit numbers with 1,2,3,...,10 different digits. For example P(3) = [0.01, 0.27, 0.72, 0, 0, 0, 0, 0, 0, 0]. The tenth (last) element of the vector is the value discussed in the problem.

Let matrix T be a transition matrix so that T*P(n-1) = P(n). P is being treated as a column vector in the multiplication. Then T is

[0.1 0 0 0 0 0 0 0 0 0 ]

[0.9 0.2 0 0 0 0 0 0 0 0 ]

[ 0 0.8 0.3 0 0 0 0 0 0 0 ]

[ 0 0 0.7 0.4 0 0 0 0 0 0 ]

[ 0 0 0 0.6 0.5 0 0 0 0 0 ]

[ 0 0 0 0 0.5 0.6 0 0 0 0 ]

[ 0 0 0 0 0 0.4 0.7 0 0 0 ]

[ 0 0 0 0 0 0 0.3 0.8 0 0 ]

[ 0 0 0 0 0 0 0 0.2 0.9 0 ]

[ 0 0 0 0 0 0 0 0 0.1 1 ]

Then T^(n-1) * P(1) = P(n). P(1) = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0], which means that P(n) is simple the first column of T^(n-1), and the value sought in the problem is the last element in that column. Then finding the desired values is as simple as raising T to various powers and inspecting element T(10,1).

Then I find n=26 is the smallest n with T(10,1)>0.5, n=34 is the smallest with T(10,1)>0.75, and n=50 is the smallest with T(10,1)>0.95. This means the answers to the the question for part a is **27**, part b is **35**, and part c is **51**.

(The best part is that I don't have to go through a ten level deep series of inclusion/exclusion probabilities, just plug a matrix expression in a suitable program and see what the result is.)