Liber Abaci/Problems/Orchard with Seven Gates

Classic Problem

 * A man entered an orchard with $7$ gates, and there took a certain number of apples.
 * When he left the orchard he gave the first guard $\dfrac 1 2$ the apples and $1$ apple more.
 * To the second guard he gave $\dfrac 1 2$ of his remaining apples and $1$ apple more.
 * He did the same for all the remaining $5$ guards, and left the orchard with $1$ apple.


 * How many apples did he gather in the orchard?

Solution
$382$ apples.

Proof
After his encounter with the $7$th guard he had one apple left.

After giving the guard $\dfrac 1 2$ his apples, and before giving him $1$ more, he would have had $2$ apples.

Hence after leaving the $6$th guard, he had $4$ apples.

Similarly:
 * after leaving the $5$th guard he had $2 \paren {4 + 1} = 10$ apples
 * after leaving the $4$th guard he had $2 \paren {10 + 1} = 22$ apples
 * after leaving the $3$rd guard he had $2 \paren {22 + 1} = 46$ apples
 * after leaving the $2$nd guard he had $2 \paren {46 + 1} = 94$ apples
 * after leaving the $1$st guard he had $2 \paren {94 + 1} = 190$ apples
 * before meeting the $1$st guard he had $2 \paren {190 + 1} = 382$ apples.