9. On the beach, there is a pile of apples that belongs to 3 monkeys. The first monkey comes, divides the apples into 3 equal piles with 1 apple left over, then it throws the extra apple into the sea and takes one pile; the second monkey comes, divides the remaining apples into 3 equal piles, again with 1 apple left over, it also throws the extra apple into the sea and takes one pile; the third monkey does the same. Then, there were at least how many apples originally.
9. 25 .

Let there be $n$ apples initially, and the remaining number of apples each time be $y_{1}, y_{2}, y_{3}$. Then
$$
\begin{array}{l}
y_{1}=\frac{2}{3}(n-1)=\frac{2}{3}(n+2)-2, \\
y_{2}=\left(\frac{2}{3}\right)^{2}(n+2)-2, \\
y_{3}=\left(\frac{2}{3}\right)^{3}(n+2)-2 .
\end{array}
$$

To make $y_{3}$ a positive integer, $n+2$ must be a multiple of $3^{3}$, so the minimum value of $n$ is 25.