Assume I have 5 millions oranges. Now I want to test a hypothesis.
If there is a black dot on an orange, then the orange is BAD.
Within these 5 millions oranges, I have been told that which are bad.
However, I cannot check all bad oranges to see whether there is black dot on each.
I want to find the sample size that I need to prove my hypothesis is right at 95% sure.
If I assume a proportion p = .999, an error E of .01 then n for a Z proportion test at the 95% confidence level is:
$$n = 1.96^2 \frac{(.001*.999)}{(.01^2)} = 38$$