In how many ways can a coin be flipped $25$ times in a row so that exactly $5$ heads occur and no more than $7$ tails occur consecutively?
For the heads, I think that it is $\binom{25}{5}$, but I do not know what to do with the tails restriction.
Not sure how to approach this problem. It is from the advanced section in the generating functions chapter in my book.
The right terms to think of are the lengths of the sequences of tails. We have six of them - one before we flip any heads, one between the first head and the second, one between the second and third, and so on until the last sequence after the fifth head. Each of these sequences can be of length $0$, $1$, $2$, $3$, $4$, $5$, $6$, or $7$.
Can you set up a generating function for this now?