When $k=5$, the following method of equalizing pressures is suitable. By dividing the cylinders into 8 groups of 5 cylinders each, we equalize the pressures in the cylinders of each of these groups. Then we form 5 new groups, each consisting of 8 cylinders that previously belonged to different groups. We achieve equal pressures in the cylinders of each of the new groups (and thus in all 40 cylinders) by first connecting the cylinders in groups of four, and then in pairs, taking cylinders from different quartets in each pair.

We will show that when $k \leq 4$, the required method does not exist.

Suppose the pressure value in one of the cylinders is 2, and in each of the others, it is 1; then after equalization, the pressure value in each cylinder should be $(2+39): 40 = 41 / 40$.

However, after each connection, all values will be expressed as irreducible fractions, the denominators of which are not divisible by 5.

Indeed, if before any connection, none of the denominators were divisible by 5, then the denominator of the arithmetic mean of the corresponding two, three, or four fractions, being double, triple, or quadruple the least common multiple of their denominators, cannot be a multiple of 5.

Since 40 is a multiple of 5, we cannot equalize the pressure with the specified initial values.

## Answer

When $k=5$.
$\underline{\text { Akulich I.F. }}$

There are 40 identical gas cylinders, the pressure values in which are unknown to us and may be different. It is allowed to connect any cylinders to each other in a quantity not exceeding a given natural number $k$, and then disconnect them; in this case, the gas pressure in the connected cylinders is set equal to the arithmetic mean of the pressures in them before connection. For what smallest $k$ does there exist a way to equalize the pressures in all 40 cylinders regardless of the initial distribution of pressures in the cylinders?

#