Answer
$a.\quad\approx 18.36$ years
$b.\quad\approx 18.31$ years
Work Step by Step
The amount A after t years due to a principal P
invested at an annual interest rate r, expressed as a decimal,
compounded n times per year is $A=P\displaystyle \cdot\left(1+\frac{r}{n}\right)^{nt}$
If the compounding is continuous, then $A=Pe^{rt}$
---
$a.$
We want $A=3P$, after $t=?$ years, with $n=12$ compounding periods per year.
and $r=0.06$
$3P =P\displaystyle \left(1+\frac{0.06}{12}\right)^{12t} \quad/\div P$
$3 =\left(1.005\right)^{12t} \quad/\log(...)$
$\displaystyle \log 3=12t\log 1.005 \quad/\times\frac{1}{12\log 1.005}$
$t=\displaystyle \frac{\log 3}{12\log 1.005}\approx 18.36$ years
$b.$
$3P=Pe^{0.06t} \quad/\div P$
$3=e^{0.06t} \quad/\ln(...)$
$\ln 3=0.06t\cdot\ln e\quad/\div 0.06, \quad\ln e=1$
$t=\displaystyle \frac{\ln 3}{0.06}\approx 18.31$ years