7. Carlo writes on a line the integers from 1 to 128 (inclusive). Then he starts erasing some of them, in this way: he erases the number 1, leaves the 2, erases the 3, leaves the 4, etc. When he reaches the end of the line, he goes back and starts erasing the first number he finds among those left, then leaves the second, etc. He continues to go back and forth along the line, erasing every other number, until only one number remains on the board. What is this last remaining number?
(A) 86
(B) 54
(C) 70
(D) 22
(E) 38
(7) The correct answer is $(A)$.

Let $x_{k}$ denote the last number remaining after proceeding as described with the numbers between $1$ and $2^{k}$. If the process is carried out with the numbers between $1$ and $2^{k+1}$, in the first step only the $2^{k}$ even numbers remain, and the subsequent $k$ steps select the even number in position $x_{k}$, counting from the end. Therefore, $x_{k+1}=2\left(2^{k}-x_{k}+1\right)=2^{k+1}-2 x_{k}+2$.

Knowing that $x_{0}=1$, we quickly obtain

$$
x_{1}=2, x_{2}=2, x_{3}=6, x_{4}=6, x_{5}=22, x_{6}=22, x_{7}=86 \text {. }
$$

Problem proposed by Antonio Fanelli.