Not trying to muddy the waters too much, but using the algebraic approach suggested has some issues when pbar is small. Remeber that the lower limit can not be less than 0%, so if your pbar is say 5%, and can tolerate a shift of 6%, you would be calculating n based on limits of -1% to 11%.
May I suggest another approach to the correct sample size to use for your subgroup. Instead of worrying about the statistical aspect (and I am a statistician
), think of the manufacturing process and inspection time/cost. If you produce lots of size 100, then using a subgroup size of 30 is excessive to estimate the percent defective. Instead, inspect every 10th unit for a total of 10 units.
Having said that, in general any sample size less than 30 for a p-chart is insufficient. Since p is the percent defective in the sample, a sample size of say 20 units means that every defective unit increases the percent by 5%. The discrimination on the chart will be insufficient to be meaningful since there are only 20 different values that any p can have for a sample.
Instead of using a p-chart, you might want to look at a continuous variable that is a surrogate for a defective unit, and measure it using a xbar type chart.
Just my $0.02