sum 3^k from k=0 to n