4. In a box, there are balls of seven colors. One tenth of the balls are red, one eighth are orange, and one third are yellow. There are 9 more green balls than red ones, and 10 more blue balls than orange ones. There are 8 blue balls in the box. The remaining balls are purple. What is the smallest possible number of purple balls?
Solution. Let the total number of balls be x, and the number of violet balls be y. Then

$$
\frac{x}{10}+\frac{x}{8}+\frac{x}{3}+\frac{x}{10}+9+\frac{x}{8}+10+8+y=x
$$

From which $47x / 60 + 27 + y = x$, that is, $y = 13x / 60 - 27$, and the smallest value of y is achieved at the smallest value of x. Since y is an integer, x is a multiple of 60. According to the condition, x must be a multiple of 8, so x is divisible by 120. For x = 120, y = -1, which is impossible. For x = 240, y = 25 and this is the smallest possible number of violet balls.

Answer. 25 balls.