I've written the following function that will repatedly call various sample size and calculate their resulting confidence interval width. The signature of this function is below.
HypoSampleSize(proportion estimated defective, N, Confidence Level, startN, endN)
Note: that startN and endN are optional parameters that define the range of sample sizes for the calculator to use. Below is the solution for the voting example, note that n=54 for the smallest n where the Confidence interval is <=.1.
HypoSampleSize (.5,100,.95,52,55)
## N (pop size) n (sample size) m (# events) CI Lower Width
## 1 100 52 26 0.11000000
## 2 100 53 26 0.10056604
## 3 100 54 27 0.10000000
## 4 100 55 28 0.09909091
## proportion (m/n) CI Upper Width
## 1 0.5000000 0.1100000
## 2 0.4905660 0.1094340
## 3 0.5000000 0.1000000
## 4 0.5090909 0.1009091