An elephant writes a sequence of numbers on a board starting with 1. Each minute, it doubles the sum of all the numbers on the board so far, and without erasing anything, writes the result on the board. It stops after writing a number greater than one billion. How many distinct prime factors does the largest number on the board have?

[i]Ray Li.[/i]
1. Let's first understand the sequence generated by the elephant. The sequence starts with 1 and each subsequent number is obtained by doubling the sum of all previous numbers on the board.

2. Let's denote the sequence by \( a_1, a_2, a_3, \ldots \). We start with \( a_1 = 1 \).

3. The next number \( a_2 \) is obtained by doubling the sum of all previous numbers:
   \[
   a_2 = 2 \times (a_1) = 2 \times 1 = 2
   \]

4. The next number \( a_3 \) is obtained by doubling the sum of all previous numbers:
   \[
   a_3 = 2 \times (a_1 + a_2) = 2 \times (1 + 2) = 2 \times 3 = 6
   \]

5. The next number \( a_4 \) is obtained by doubling the sum of all previous numbers:
   \[
   a_4 = 2 \times (a_1 + a_2 + a_3) = 2 \times (1 + 2 + 6) = 2 \times 9 = 18
   \]

6. We can observe a pattern here. Let's generalize this pattern. The \( n \)-th number \( a_n \) is given by:
   \[
   a_n = 2 \times \left( \sum_{i=1}^{n-1} a_i \right)
   \]

7. Notice that the sum of all previous numbers up to \( a_{n-1} \) can be written as:
   \[
   S_{n-1} = a_1 + a_2 + \cdots + a_{n-1}
   \]

8. Therefore, \( a_n \) can be written as:
   \[
   a_n = 2 \times S_{n-1}
   \]

9. We can also observe that each \( a_n \) is a multiple of the previous sum doubled. This means:
   \[
   S_n = S_{n-1} + a_n
   \]

10. From the pattern, we can see that each \( a_n \) is of the form \( 2 \times 3^{n-2} \). This can be proved by induction.

11. Base case: For \( n = 2 \), \( a_2 = 2 \times 3^{2-2} = 2 \times 3^0 = 2 \).

12. Inductive step: Assume \( a_k = 2 \times 3^{k-2} \) holds for some \( k \geq 2 \). Then for \( k+1 \):
    \[
    a_{k+1} = 2 \times \left( \sum_{i=1}^{k} a_i \right) = 2 \times \left( 1 + 2 + 6 + \cdots + 2 \times 3^{k-2} \right)
    \]
    The sum inside the parentheses is a geometric series with the first term 1 and common ratio 3. The sum of the first \( k \) terms of a geometric series is:
    \[
    S_k = \frac{3^k - 1}{2}
    \]
    Therefore,
    \[
    a_{k+1} = 2 \times \left( \frac{3^k - 1}{2} \right) = 3^k - 1
    \]

13. The largest number on the board is the first number greater than one billion. We need to find the smallest \( n \) such that:
    \[
    2 \times 3^{n-2} > 10^9
    \]

14. Solving for \( n \):
    \[
    3^{n-2} > \frac{10^9}{2} = 5 \times 10^8
    \]
    Taking the logarithm base 3:
    \[
    n-2 > \log_3 (5 \times 10^8)
    \]
    Using the change of base formula:
    \[
    \log_3 (5 \times 10^8) = \frac{\log_{10} (5 \times 10^8)}{\log_{10} 3}
    \]
    \[
    \log_{10} (5 \times 10^8) = \log_{10} 5 + \log_{10} 10^8 = \log_{10} 5 + 8
    \]
    \[
    \log_{10} 5 \approx 0.6990
    \]
    \[
    \log_{10} 3 \approx 0.4771
    \]
    \[
    \log_3 (5 \times 10^8) \approx \frac{0.6990 + 8}{0.4771} \approx 18.2
    \]
    Therefore,
    \[
    n-2 > 18.2 \implies n > 20.2
    \]
    The smallest integer \( n \) is 21.

15. The largest number on the board is \( 2 \times 3^{21-2} = 2 \times 3^{19} \).

16. The prime factors of \( 2 \times 3^{19} \) are 2 and 3.

The final answer is \(\boxed{2}\).