> # Oskar Hagberg 2012-03-12 > # The standard deviation is > sdev = 3 > # The length of a 95 % confidence interval is > # 2*1.96*3/sqrt(n) > # The problem can be solved by simple trial and error: > 2*1.96*3/sqrt(120:139) [1] 1.0735362 1.0690909 1.0647004 1.0603635 1.0560792 1.0518464 1.0476641 1.0435313 1.0394470 [10] 1.0354103 1.0314202 1.0274760 1.0235766 1.0197213 1.0159093 1.0121396 1.0084117 1.0047246 [19] 1.0010777 0.9974702 > # Hence 139 is the minimum. > # Alternative solution: solve > > # 2*1.96*3/sqrt(n) <1 > # n > (2*1.96*3)^2 > (2*1.96*3)^2 [1] 138.2976