Kostrikina I.A.

At a round table, pastries are placed at equal intervals. Igor walks around the table and eats every third pastry he encounters (each pastry can be encountered several times). When there were no pastries left on the table, he noticed that the last pastry he took was the first one he encountered, and he had walked exactly seven rounds around the table. How many pastries were there?
Since Igor passed an integer number of circles, he met the first pastry at the moment of approaching the table. In addition, the sequence of eating pastries will not change if we remove the requirement of "equal intervals". If there were four pastries, Igor would have walked exactly five circles (see the figure).

![](https://cdn.mathpix.com/cropped/2024_05_06_9c89379ec21d997cc715g-15.jpg?height=703&width=786&top_left_y=2127&top_left_x=636)

Let the number of pastries on the table be divisible by three. Then, in the first circle, Igor eats every third pastry and returns to the initial position. Thus, after one circle, the number of pastries becomes $2 / 3$ of the number that was on the table. Therefore, if there were six pastries, Igor would have walked exactly six circles, and if there were nine pastries, Igor would have walked exactly seven circles.

If there are more than nine pastries, then Igor will travel some distance before the number of pastries is exactly nine, reach the nearest pastry, and then make exactly seven circles. Thus, in total, he has walked more than seven circles.

If there are fewer than nine pastries, and the number of circles is also seven, then, as shown above, we prove that for nine pastries, the number of circles is more than seven. Contradiction.

## Answer

9.