Sizing a poll

How many voters should a poll sample so that the 95% Wald interval for a proportion has half-width at most 0.02, whatever the true proportion? How does the answer change if earlier polls show the proportion is near 0.1?

The half-width is 1.96\sqrt{p(1-p)/n}. Since p(1-p)\le1/4 for every p, requiring 1.96\sqrt{1/(4n)}\le0.02 guarantees the bound:

n\ge\frac{1.96^2}{4\times0.02^2}=2401.

If p is near 0.1, then p(1-p)\approx0.09, and n\ge1.96^2\times0.09/0.02^2=865 is enough. Knowing the proportion is far from 1/2 cuts the required sample by almost two thirds, but if the guess is wrong the interval will be wider than planned.