39. At the ends of the diameter of a circle, units are placed. Each of the resulting semicircles is divided in half, and in its middle, the sum of the numbers at the ends is written (first step). Then each of the four resulting arcs is divided in half, and in its middle, the number equal to the sum of the numbers at the ends of the arc is written (second step). This operation is performed $n$ times. Find the sum of all the written numbers.
39. Answer: $2 \cdot 3^{\text{n }}$. After the first step, the sum of all numbers will be $6=2 \cdot 3$.

Let $S_{n}$ be the sum of all numbers after the $n$-th step. It is not hard to prove that after the $(n+1)$-th step, the sum will become $2 S_{n}+S_{n}=3 S_{n}$.

Thus, the sum of all numbers triples each time, so on the $n$-th step, it will be equal to $2 \cdot 3^{n}$.

$\nabla$ The interesting sequence that arises here is discussed in problem 219 of the book [10] and M233 from the "Kvant Problem Book" ("Kvant", 1974, No. 7).