## 126. Math Puzzle 11/75

A gardener sold half of all his apples and half an apple to the first buyer, half of the remaining apples and another half an apple to the second buyer, half of the remaining apples and half an apple to the third buyer, and so on.

To the seventh buyer, he sold half of the remaining apples and another half an apple. Then he had none left.

How many apples did the gardener have at the beginning?
If the initial number of apples is $x$, the equation is

$$
\begin{gathered}
\frac{x+1}{2}+\frac{x+1}{2^{2}}+\frac{x+1}{2^{3}}+\ldots+\frac{x+1}{2^{7}}=x \\
(x+1)\left(\frac{1}{2}+\frac{1}{2^{2}}+\frac{1}{2^{3}}+\ldots+\frac{1}{2^{7}}\right)=x
\end{gathered}
$$

The terms in the second parenthesis form a geometric sequence. For the sum of the sequence, we have

$$
\frac{x}{x+1}=1-\frac{1}{2^{7}} \quad \text { and } \quad x=2^{7}-1=127
$$

In total, there were 127 apples.