# Sample size to determine if success proportion is zero

I have a lot of $N$ devices, and I'd like to know if any of them are faulty. What sample size do I need in order to make sure with $100(1-\alpha)\%$ confidence that none are faulty?

-

You are asking for the number $m$ to sample so that when one or more devices are faulty, there will be at least a $100(1-\alpha)$% chance that at least one faulty device is in the sample. You have to handle the worst case of just one faulty device. Assuming the sample is random without replacement, we have (by definition) that there are $\binom{N}{m}$ such samples and $\binom{N-1}{m}$ of them do not include the faulty device. Therefore you need to find the smallest $m$ for which
$$\alpha \ge \binom{N-1}{m} / \binom{N}{m} = 1-\frac{m}{N}.$$
The solution is to take $m$ to be any whole number equal to or exceeding $(1-\alpha)N$. In brief, if you want to be (say) 95% confident there are no faulty devices, then you have to sample 95% of the lot.
You would be better off using a sequential sampling procedure if you can: sample the devices one at a time, stopping as soon as a faulty one is found or $100(1-\alpha)$% of them are sampled. For typical high confidence levels, the cost of sampling $100(1-\alpha)$% is so close to the cost of sampling $100$% that it's not worthwhile stopping there; plan to sample them all if necessary.