I want to calculate a 90% confidence interval for $n$ (from $X$~Bin$(n,0.3)$) where the number of successes is known ($x=12$). I have found the smallest $n$ so that $P(X \le 12)\le 0.05$ is 61 and the largest $n$ so that $P(X \ge 12)\le 0.05$ is 25. However I can't find any examples online or in my textbook that construct CIs for $n$, only ones that do so for $p$ so I am a bit lost on where to go from here. Any hints would be greatly appreciated.
Update: I think I must use some pivot variable. For example, I know that $0.9 = P(-1.64 \le N(0,1) \le 1.96)$. Also, for large $n$, $X$~Bin$(n,p)$ has an approximate $N(np, np(1-p))$ distribution. If I let $\hat n=\frac{X}{p}$ denote the estimator of $n$, then $\hat n$ has an approximate $N(n, \frac{n(1-n)}{p})$ distribution (although I'm not 100% sure about this latter part). Then, I should be able to say $\frac{\hat n -n}{\sqrt{n(1-n)/p}}$~$N(0,1)$ and so I can substitute this into my first equation and get: $$0.9 = P(-1.64 \le \frac{\hat n -n}{\sqrt{n(1-n)/p}} \le 1.96)$$ and then rearrange for $\hat n$ by itself in the middle of the inequality. My only concern is that $\hat n$ does not an approximate $N(n, \frac{n(1-n)}{p})$ distribution rendering this incorrect. Does anyone have any ideas?
Update 2: Just realised the $n(1-n)$ will be negative (since $n \ge 12$) and so we will get an imaginary number in the square root, thus my proposed solution is wrong. Back to square one :(
With n large enough (here $n$ looks like around $\frac{12}{0.3}=40$, so far so good) you can approximate
$$Bin(n;0.3)\approx N(0.3n;0.21n)$$
Thus your interval becomes
$$\Bigg| \frac{12-0.3n}{\sqrt{0.21n}}\Bigg|\leq 1.64$$
Solving this double inequality (it's an easy quadratic inequality) it results to me
$$[27;59]$$
I think that this post can be useful for your reasoning