I would start by describing the question:
Assuming A-Z are letters assigned with different probabilities of appearance. We have a target pattern in letters: A--K-M, six letters in length with three blanks. Now we have a string of 105 letters, what is the probability that we find at least one occurrence of the targeted pattern in the given string? (each letter in the string could be considered as an independent event)
Firstly, I solve it by multiplying the probabilities of the three fixed letters (let's call it p), and multiplied it by the available start points of the target p(105-6+1).
Then I realized that if the string is long enough, I would definitely got a probability higher than one.
In the next try, I applied binomial distribution equation, and the result went to 1 - (zero occurrence in binomial distribution). In R, it would be 1-dbinom(0,100,p).
Could anyone kindly explain to me, why my first or second try was wrong(if so)?
Please notice that this question was simplified by me. The original question was based on a biological sequence data. The actual string length and the probability of letters were depended on the species, and the string length would not be "long enough" to consider the extreme case.