You roll a dice with s sides for n times. What is the probability that t sides appeared once? Example with s=2, n=3: you roll a dice with 2 sides for 3 times. possible outcomes: '1' and '2'. - p(t=0) is the probability that '1' appeared 0 times and '2' appeared 3 times + the probability that '2' appeared 0 times and '1' appeared 3 times, that is 1/4 - p(t=1) is the probability that '1' appeared once and '2' appeared twice + the probability that '2' appeared once and '1' appeared twice, that is 3/4 - p(t=2)=0, because it is impossible that both '1' and '2' appear once. If there is a formula f(s,n,t) it will be awesome, but also an algorithm is welcome.