A box has 1000 pennies. One penny in the box has 2 heads. A coin is selected at random and flipped 5 times. If the coin comes up heads each time, what is the probability that the selected coin had two heads?
$$P(\text{ Two sided coin }|\text{ getting 5 heads })=\frac{P(\text{ getting 5 heads }|\text{ two sided coin }) \times P(\text{ picking two sided coin })}{P(\text{ getting 5 heads })}$$ $$ P(\text{ Two sided coin }|\text{ 5 heads })=\frac{(1\times1/1000)}{(1/2\times1/2\times1/2\times1/2\times1/2)}$$ $$ P(\text{ Two sided coin }|\text{ 5 heads })=1.024$$
Now clearly this is incorrect, but I am not understanding why, as I feel I have used Bayes the correct way
First, check your calculation of $(1/2)^5$.
But even that does give the exact answer: when calculating $P(\text{getting 5 heads})$, you should consider also the fact that there is a biased coin, $$ P(\text{getting 5 heads}) = P(\text{getting 5 heads} \cap \text{two-sided coin}) + P(\text{getting 5 heads} \cap \text{fair coin}) = \cdots $$