2. In the buses of a travel agency, members of a tourist group need to be arranged so that each bus has the same number of tourists. At the beginning, 22 tourists entered each bus, leaving one tourist unscheduled. However, one bus left empty, and the tourists were then evenly distributed among the remaining buses. How many tourists and buses were there at the beginning, if no more than 32 tourists entered each bus?
Solution. Let $k$ be the number of buses that the travel agency sent at the beginning. From the condition of the problem, it follows that $k \geq 2$, and the number of tourists is $22k + 1$. After one bus left, the tourists could be evenly distributed among $k-1$ buses. This means that the number $22k + 1$ is divisible by $k-1$. The problem reduces to determining the numbers $k, n$ such that $k \geq 2$ and $n=\frac{22k + 1}{k-1}$ is an integer, with $n \leq 32$.

The number $n=22+\frac{23}{k-1}$ is an integer if and only if $\frac{23}{k-1}$ is an integer. However, this is possible only for $k=2$ and $k=24$. If $k=2$, then $n=45$, which is not possible since $n \leq 32$. If $k=24$, then $n=23$. Therefore, at the beginning, there were 24 buses, and the number of tourists was $n(k-1)=23 \cdot 23=529$.