Answer
$16.98$ years.
Work Step by Step
Use the given formula $A=P(1-r)^n$.
where $P$ is the principal, the amount now, $r$ is the annual inflation rate, $n$ is the number of years, $A$ is the amount $P$ will be worth back after $n$ years
Here
$P=2A$ (because the purchasing power is cut in half)
$r=0.04=4\%$
Hence
$A=2A(1-0.04)^n\\\frac{1}{2}=0.96^n\\0.5=0.96^n\\\log_{0.96}0.5=\log_{0.96}{0.96^n}\\\log_{0.96}0.5=n$
Therefore by using a calculator $n=\log_{0.96}{0.5}=16.98$ years.