Sample Size Calculations for Binomial Distributions

Say we have a sequence of independent Bernoulli experiments and we want to make claims about the true probability of success, given our observations. How many trials do we need to make claims about the true probability with a certain confidence? Let’s derive this from first principles.