I have a rather straightforward question for this community (that I am not able to solve). Assume there is a probability of Tom having a bag of candy. If Tom has a bag, he says the truth 4/5 times and lies 1/5 times. If he does not have the bag, he is honest and says he does not. How do I devise an algorithm that would calculate the minimum probability p that he always tells the truth after n attempts - where each attempt is a question asking Tom if he has a bag of candy.
I realise that this is a Monte Carlo problem with 1 sided error and that in n attempts, if all the questions asked were if he had the bag, it would be $$(\frac{4}{5})^n$$ and if independently asked when he doesnt have it, it would be 1^n but when combined, how will this work? Is it just a binomial probability summation like $$\sum_{i=1}^{n}{n \choose x}\frac{4}{5}^i*1^{n-i}$$
As a follow up, if he also starts to lie when he does not have bag, with again say 1/5 probability - says truth 4/5 of the times he is asked, how would you generate an algorithm to calculate the minimum probability of telling truth after n attempts.