There's a .999 chance you have a fair coin and a .001 chance you have the rigged coin.
(0.999 * 0.5) + (0.001 * 1) = 0.5005.
Seems too simple, but a coin is a coin, right?
So figure the p(heads) for the coin and ignore the previous history. Overthinking it is why this makes a good FizzBuzz problem.
Suppose that the jar contains 500 double-head coins and 500 double-tail coins. You pull a coin from the jar, flip it 10 times, and get 10 heads. What is the probability it will come up heads next time?
Let's also say that every time you flip the coin and it comes up tails, you win $5. And every time you flip the coin and it comes up heads, you lose $1.
Clearly, this would be a great game to have the opportunity to play, if the coin is fair. Every time you flip you either win $5 or lose $1, so your profit, on average, is $4 per flip.
You've flipped it 10 times so far, and it's come up heads every time, and you've lost $10.
After you're $10, $100, $1000, or $10e100 in the red, without ever seeing a win, when do you change your mind about playing this game?