**129 coins lie on a table. Of these coins, 128 are fair and the other has heads on both sides. After picking a coin at random, ignorant of its nature, you flip it eight times, turning up eight consecutive heads. What is the probability that the ninth is a head?**

Hmm, is this right?:

There are 2^8 = 256 ways of tossing 8 heads with the unfair coin as each of the heads could be from either of two sides.

There is only one way of tossing 8 heads with a single fair coin. However there are 128 fair coins to toss them with - therefore there are 128 ways of throwing heads with the fair coins.

Therefore the probability that the actual coin chosen is unfair is 256/(256+128) = 2/3, and so the probability that it is a fair coin is 1/3

The probability of the next toss being heads is the probability of EITHER the actual coin being fair (1/3) AND tossing a head with it (1/2) OR the actual coin being unfair (2/3) AND tossing a head with it (1).

So the total probability of throwing a head next is 1/3*1/2 + 2/3 = 5/6

(I think, if you have F fair coins, U unfair coins and have already thrown H heads then the probability of throwing another head is:

(2^H*2U+F)/(2^H*2U+2F)