Task B-1.7. Mother divided a certain number of apples among her children. Petar received half of the total number of apples and two more. Ivan received half of the remaining number of apples and two more. Finally, Ana received half of what was left and two more apples. In the end, one apple remained. How many apples were there at the beginning, and how many apples did each child receive?
## Solution.

Let $x$ be the initial number of apples, and let $a, b, c$ be the number of apples received by Petar, Ivan, and Ana, respectively.

Petar received

$$
a=\frac{x}{2}+2
$$

This means that $\frac{x}{2}-2$ apples remained.

Ivan received

$$
b=\frac{x-a}{2}+2=\frac{1}{2}\left(\frac{x}{2}-2\right)+2=\frac{x}{4}+1
$$

apples.

After that, 

$$
x-a-b=\frac{x}{2}-2-\frac{x}{4}-1=\frac{x}{4}-3
$$

apples remained.

Ana received

$$
c=\frac{x-a-b}{2}+2=\frac{1}{2}\left(\frac{x}{4}-3\right)+2=\frac{x}{8}+\frac{1}{2}
$$

apples.

At the end, one apple must remain. We write

$$
x-a-b-c=1
$$

From the above equations, we get the equation

$$
\frac{x}{4}-3-\frac{x}{8}-\frac{1}{2}=1
$$

whose solution is $x=36$. Initially, there were 36 apples.

Petar received $a=20$ apples.

Ivan received $b=10$ apples.

Ana received $c=5$ apples.