17. Streak of Luck (from 9th grade, 4 points). A coin is tossed $n$ times. A streak of luck of length $k$ is a sequence of $k$ consecutive heads. Find the probability that the longest streak of luck in 10 coin tosses will be of length 4.
Solution. For brevity, let's call the length of the maximum lucky strip the "lucky value" of the sequence. Let $S_{n}^{k}$ be the number of different sequences of length $n$ with a lucky value of $k$. Each such sequence ends either with a tail (T) or a group of THH...H, where the number of heads can be any from 1 to $k$.

If it ends with a tail, then by removing it, we get a sequence of length $n-1$ with a lucky value of $k$. There are a total of $S_{n-1}^{k}$ such sequences.

If it ends with TH, then by removing this group, we get one of the $S_{n-2}^{k}$ sequences of length $n-2$ with a lucky value of $k$. And so on.

The remaining case is when the sequence ends with a group of THH...H, where the number of heads is $k$. By removing this group, we get a sequence of length $n-k-1$ with a lucky value of $k$ or less. There are a total of $S_{n-k-1}^{k}+S_{n-k-1}^{k-1}+S_{n-k-1}^{k-2}+\ldots+S_{n-k-1}^{0}$ such sequences.

Therefore,

$$
S_{n}^{k}=S_{n-1}^{k}+S_{n-2}^{k}+\ldots+S_{n-k}^{k}+S_{n-k-1}^{k}+S_{n-k-1}^{k-1}+S_{n-k-1}^{k-2}+\ldots+S_{n-k-1}^{0}
$$

For any $n=0,1, \ldots$, the equalities $S_{n}^{n}=S_{n}^{0}=1$ hold.

Calculations are conveniently performed in a table.

| $\boldsymbol{k}$ | $\mathbf{0}$ | $\mathbf{1}$ | $\mathbf{2}$ | $\mathbf{3}$ | $\mathbf{4}$ | $\mathbf{5}$ | $\mathbf{6}$ | $\mathbf{7}$ | $\mathbf{8}$ | $\mathbf{9}$ | $\mathbf{1 0}$ |
| :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
| $\mathbf{0}$ | $\mathbf{1}$ | $\mathbf{1}$ | $\mathbf{1}$ | $\mathbf{1}$ | $\mathbf{1}$ | 1 | 1 | 1 | 1 | 1 | 1 |
| $\mathbf{1}$ |  | $\mathbf{1}$ | 2 | 4 | $\mathbf{7}$ | 12 | 20 | 33 | 54 | 88 | 143 |
| $\mathbf{2}$ |  |  | $\mathbf{1}$ | 2 | 5 | 11 | 23 | 47 | 94 | 185 | 360 |
| $\mathbf{3}$ |  |  |  | $\mathbf{1}$ | $\mathbf{2}$ | 5 | 12 | 27 | 59 | 127 | 269 |
| $\mathbf{4}$ |  |  |  |  | $\mathbf{1}$ | $\mathbf{2}$ | 5 | 12 | 28 | 63 | $\mathbf{1 3 9}$ |

In the figure, it is clear how the summation occurs. The first row and the diagonal need to be filled with ones, and then the other numbers can be found sequentially. For example, to get $S_{4}^{2}=5$, you need to add five numbers along the left and bottom sides of the $3 \times 3$ square located to the left of the required cell $S_{4}^{2}$. And so on. To get the number $S_{10}^{4}=139$, you need to add 9 numbers along the left and bottom sides of the corresponding $5 \times 5$ square. The numbers in lighter font are those that are not used in the calculation of $S_{10}^{4}$. You can "save" on them. With a spreadsheet or a small program, the calculation is done very quickly.

Thus, there are a total of 139 random equiprobable sequences of length 10 with a lucky value of 4. And there are exactly $2^{10}=1024$ binary sequences of length 10. Therefore, the required probability is $\frac{139}{1024}$ or, approximately, 0.136.

Answer: $\frac{139}{1024}$.