Skip to content

Instantly share code, notes, and snippets.

@FrancoisMalan
Created November 7, 2016 13:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FrancoisMalan/6671afc0b073f09939d4707f2bd63950 to your computer and use it in GitHub Desktop.
Save FrancoisMalan/6671afc0b073f09939d4707f2bd63950 to your computer and use it in GitHub Desktop.
Lorita se notebook
import math
def comb(n, k):
return int(math.factorial(n)/(math.factorial(k)*math.factorial(n-k)))
def lorita_sum(number_machines, available_machines, availability_percent):
result = 0
prob = availability_percent / 100
for i in range(number_machines-available_machines+1):
result += comb(number_machines, i) * math.pow(1-prob, i) * math.pow(prob, number_machines-i)
return result * 100
lorita_sum(40, 37, 99.97)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment