an=a(n-1)+(1/2)^n
=a(n-2)+(1/2)^(n-1)+(1/2)^n
=...
=a1+(1/2)^2+(1/2)^3+...+(1/2)^n
=2+1-(1/2)^(n-1)=3-(1/2)^(n-1)