Created
November 7, 2016 13:49
-
-
Save FrancoisMalan/6671afc0b073f09939d4707f2bd63950 to your computer and use it in GitHub Desktop.
Lorita se notebook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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