The formula for continuous compounding: A = P·e^(r·t)
For this problem, let's assume that you start with $1.00 and you end with 20% more, that is, $1.20.
A = final amount = 1.20 P = beginning amount = 1.00
r = rate (as a decimal) = 0.035 t = number of years
---> 1.20 = 1.00·e^(0.035·t)
Divide both sides by 1.00:
---> 1.20 = e^(0.035·t)
Take the ln of both sides: ln(e^x) = x ---> ln( e^(0.035·t) ) = 0.035t
---> ln(1.20) = 0.035·t
Divide both sides by 0.035:
---> t = ln(1.20) / 0.035 = 5.21 years
You don't have to start with $1.00; you can start with any amount, just so you end with a number that is 20% larger.
(This formula is also known as the 'shampoo formula'.)