Here is the general formula the probability of x events in n trials with a probability of success P is given by
Note: this only works if there are two outcomes, sucess or failure.
So in your case with rolling a 6 exactly 3 times in 5 attemps would be
Now you could do the same for 4 and 5
Then your probability would be
Read this to help with the theory behind it
Binomial probability - Wikipedia, the free encyclopedia
I hope this helps.