1.015n(4000)=1.04n(3542)
Divide both sides by 4000.
1.015n=1.04n(35424000)
Divide both sides by 1.04^n
1.015n1.04n=35424000
That is:
(1.0151.04)n=35424000
(1.0151.04)n=0.8855
n equals the log base (1.015/1.04) of 0.8855, but since most calculators can only do base 10 or base e, we will need to use a change of base formula.
This page talks about the change of base formula: http://www.purplemath.com/modules/logrules5.htm
That tells you that:
n = [ln 0.8855]/[ln (1.015/1.04)]
Just plug that into a calculator to get that
n ≈ 4.998