Hey Shakarri.

If you are trying to find the relative difference between the mean and the standard error then simply set up the inequality and solve for n.

If you are using a Wald test or a normal approximation then the standard error of the mean with a binomial is se = SQRT(p_hat*(1-p_hat)/n) where p_hat is the estimated value of the proportion which is just the mean of the sample data.

So you are looking at [1.96*se]/p_hat < t where t is your threshold (3% = 0.03) so extracting n we get:

(1.96)^2*(1-p_hat)/(p_hat*t^2) < n or

n > (1.96)^2*(1-p_hat)/(p_hat*t^2)

So you can find the first integer satisfying that condition and you have your sample size.

If you want to consider that p_hat can fluctuate within a specific range then you will need to do this for the lower and upper bounds and combine both information to get a value for n.