Last active
May 20, 2016 11:33
-
-
Save olliefr/19c9e93cd2f6babae0b103feb7f63ab7 to your computer and use it in GitHub Desktop.
Brain teaser - summing the PMFs approach.
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
n <- 400 # number of tosses in a single trial | |
m <- 220 # threshold of interest | |
s <- 0 # the sum of binomial coefficients | |
for (k in m:n) { | |
s = s + choose(n,k) | |
} | |
p = s / 2^n | |
print(round(p, digits=2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment