think of the economy as a bank account with some interest rate.

It's future value FV (FV) is given, in terms of the interest rate (R), time (T), and present value (PV) as

$$FV=PV(1+R)^T$$

In this problem you are looking for the time T it takes for FV/PV=2, i.e. the economy has doubled.

$$2=(1+0.04)^T$$

$$\log(2)=T\log(1.04)$$

$$T=\frac{\log(2)}{\log(1.04)}$$

$$T \approx 17.67\text{yrs}$$