Confidence intervals are used to find a region in which we are 100 * ( 1 - α )% confident the true value of the parameter is in the interval.

For large sample confidence intervals about the population proportion you have:

phat ± z * sqrt(phat * (1- phat) / n)

where phat is the sample proportion z is the zscore for having α% of the data in the tails, i.e., P( |Z| > z) = α n is the sample size

To find the sample size needed for a confidence interval of a given size we need only to concern ourselves with the error term and the width of the interval. We know that the interval is centered at phat so we need to find the value of n such that

z * sqrt(phat * (1-phat) / n) = width.

The z-score for a 0.99 confidence interval is the value of z such that 0.005 is in each tail of the distribution. z= 2.575829

The equation we need to solve is: z * sqrt(phat * (1-phat) / n) = width

n = phat * (1 - phat) * (width / z) ^ -2.

If we don't know anything about phat and are still asked to find the sample size we let phat = 0.5. This maximizes the value of the error term and if n is sufficient for phat = 0.5, the n will be sufficient for all other values of phat.