I followed the example given by Anand Gautam, and solved the equation :$ \hat n_{ML} = \text{max}_n ( \binom{n}{1000000} p^{1000000} (1-p)^{n-1000000} ) $. and the answer i got is n=(1e6)/p, which make sense to me. for example, u tos coin n times, got 5 heads,the probablity of getting head is 1/2, asking you to find n. it is quite obvious, n=5/0.5=10, in other words n=# of heads/p.