Answer
$16.98$ years
Work Step by Step
Inflation: The amount A that ${{\$}} P$ can purchase after n years,
with annual inflation rate r (decimal) is $A=P\cdot(1-r)^{n}$
---
We want n for which
$A=0.5P,$, with $ r=0.04$.
$0.5P=P(1-0.04)^{n} \qquad.../\div P$
$0.5=(0.96)^{n} \qquad.../\log(..)$
$\log 0.5=n\log 0.96$
$n=\displaystyle \frac{\log 0.5}{\log 0.96}\approx 16.98$ years