An investigator, interested in estimating a population mean, wants to be sure that the length of the 95% confidence interval does not exceed 5. What sample size should she use if σ = 18?

3. The attempt at a solution
the formula I found in my book is n = [(z_(α/2) σ)/E]^2

z_(α/2) = z.025 = 1.96

I am fairly certain if the length of the interval can't exceed 5, then 5 will be the max error so
E = 5
n = [1.96(18)/5]^2 = 49.8

Am I doing this correctly?

Avoid using canned formulas; rather, work things out from first principles. So ask yourself: if ##X_1, X_2, \ldots, X_n## are iid random variables from the distribution ##N(\mu,\sigma^2)##, what is the distribution of the sample mean
[tex] \bar{X} = \frac{1}{n} \sum_{i=1}^n X_i \: ? [/tex]
Now you need to know how large to make ##n## in order to have
[tex] P(-2.5 \leq \bar{X} - \mu \leq 2.5 ) = 0.95, [/tex]
assuming that you know ##\sigma = 18##. At that point you are ready to state with absolute confidence the appropriate test to use. (And no, I will not tell you if you are correct or not!)