# Probability of Five Distinct Faces When Five Dice Are Rolled

This question is very similar to one asked on Probability of All Distinct Faces When Six Dice Are Rolled

Now mine has a little spin on it and is: if five fair dice are rolled what is probability that FIVE numbers will appear exactly once?

If anyone is interested, my main goal is making a python script that can calculate the probability, since I'm new to this, this is what I got (though am positive it's wrong):

def numOne(roll):
return len([dice1 for dice1 in roll if dice1 == 1])
def numTwo(roll):
return len([dice2 for dice2 in roll if dice2 == 2])
def numThree(roll):
return len([dice3 for dice3 in roll if dice3 == 3])
def numFour(roll):
return len([dice4 for dice4 in roll if dice4 == 4])
def numFive(roll):
return len([dice5 for dice5 in roll if dice5 == 5])
def numSix(roll):
return len([dice6 for dice6 in roll if dice6 == 6])

r = range(1,7)
sample = [(i,j,k,l,m) for i in r for j in r for k in r \
for l in r for m in r]
event = [roll for roll in sample if numOne(roll)==1 and numTwo(roll)==1 and
numThree(roll)==1 and numFour(roll)==1 and numFive(roll)==1 or
numSix(roll)==1]

print(len(event) / len(sample))


The output is: 0.417309670781893 or 3245 / 7776

• Welcome to MSE. It will be more likely that you will get an answer if you show us that you made an effort. – José Carlos Santos Feb 7 '18 at 12:00
• Your event is wrong. The last few entries shows ... (6, 5, 5, 5, 1), (6, 5, 5, 5, 2), (6, 5, 5, 5, 3), (6, 5, 5, 5, 4), (6, 5, 5, 5, 5)]. – GNUSupporter 8964民主女神 地下教會 Feb 7 '18 at 12:57
• Indeed. I have very little knowledge of python (started 2 days ago) and in event I made the program check for the first five distinct faces, in other words, only faces with 1, 2, 3, 4 and 5 number and leaving the last face (which is 6) to be a choice rather than something necessary which is stupid I know... – Midou35000 Feb 7 '18 at 13:07
• IMHO, a combinatoric argument much easier than debugging code. – GNUSupporter 8964民主女神 地下教會 Feb 7 '18 at 15:01

If you want five different faces, then for the first die you have $6$ possibilities, then for the second there will be $5$ left, then for the third there will be $4$ left, etc.
So, out of $6^5=7776$ possible outcomes, there will be $6\cdot 5 \cdot 4 \cdot 3 \cdot 2=720$ where the five dice have different faces.
Thus, the probability is $$\frac{720}{7776}$$