Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First_C solution in Creative category for Probably Dice by frbrgeorge
from math import factorial
def C(n,k):
return factorial(n)/(factorial(k)*factorial(n-k))
def probability(n, s, t):
return sum((-1)**k*C(n,k)*C(t-s*k-1, n-1) for k in range((t-n)//s+1) if n<=t<=n*s)/s**n
Feb. 18, 2019