4.1. Every evening, starting from September 1st, little Anton ate one pastry. After eating another pastry, he noticed that during this entire time, he had eaten 10 delicious pastries (the rest seemed tasteless to him). But among any seven consecutive pastries he ate, no fewer than three turned out to be delicious. What is the maximum number of pastries Anton could have eaten?
Answer: 26

Solution. We will show that among 27 pastries, there will be no fewer than 11 delicious pastries. Let's number the pastries from 1 to 27. Note that among the first seven pastries, at least three are delicious, among the next seven as well, and among the pastries numbered from 15 to 21, there are at least three more (a total of nine delicious pastries have been found).

Among the pastries numbered from 21 to 27, there are also at least three delicious ones. One of them could have been counted earlier (if the pastry numbered 21 is delicious), but there will be at least two more delicious pastries with numbers from 22 to 27. Thus, there could not have been more than 26 pastries.

Note that there could have been 26 pastries. For example, let the delicious pastries be those with numbers $5, 6, 7, 12, 13, 14, 19, 20, 21, 26$. It is easy to see that the conditions of the problem are satisfied.