# Thread: probability of distinct numbers?

1. ## probability of distinct numbers?

What is the probability that a 10 digit number does not have four distinct digits?
i.e. calculate the probability that the 10 digit number has at most three distinct digits

Distinct digit = not occurring in the 10 digit number more than once
ex: 10 digit number 6677564492
distinct digits = 5, 2, 9

2. Originally Posted by tiffanat
What is the probability that a 10 digit number does not have four distinct digits?
i.e. calculate the probability that the 10 digit number has at most three distinct digits

Distinct digit = not occurring in the 10 digit number more than once
ex: 10 digit number 6677564492
distinct digits = 5, 2, 9
CORRECTION: I posted an erroneous version earlier, where I got my permutations and combinations mixed up. Here is a corrected version. Sorry if I confused anyone.

Hi tiffanat,

For the sake of simplicity, I'm going to assume that leading zeros are OK; i.e., 0123456789 is a 10-digit number. With that assumption, there are 10^10 possible numbers, each of which is equally likely. So all we have to do is count how many have at most three distinct digits. Let's break the problem into parts and count those that have exactly k distinct digits, for k = 1, 2, 3.

The number of ways to break the 10 digits into k non-empty subsets is, by definition, a "Stirling number of the second kind", S(10, k). See Stirling numbers of the second kind - Wikipedia, the free encyclopedia. You can compute Stirling numbers in various ways-- I cheated and used math software below. Given a division of the 10 digits into k subsets, k digits can be assigned to the subsets in P(10, k) ways, the number of permutations of 10 objects taken k at a time. So the total number of ways to write a 10-digit number using at most 3 digits is

$P(10,1) \; S(10,1) + P(10,2) \; S(10,2) + P(10,3) \; S(10,3)$
$= 10 \times 1 + 90 \times 511 + 720 \times 9330 = 6,763,600$

Therefore the probability that a 10-digit number will contain at most 3 distinct digits is 6,763,600 / 10^10 = 0.00067636.